Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos
Commits
942bac49
Commit
942bac49
authored
Jun 23, 2016
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: Remove downloader recipe, it is dupplicated with slapos.recipe.build.
parent
601eee69
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
125 deletions
+3
-125
setup.py
setup.py
+0
-1
slapos/recipe/downloader.py
slapos/recipe/downloader.py
+0
-124
software/unstable/lxc/software.cfg
software/unstable/lxc/software.cfg
+3
-0
No files found.
setup.py
View file @
942bac49
...
...
@@ -96,7 +96,6 @@ setup(name=name,
'cron = slapos.recipe.dcron:Recipe'
,
'cron.d = slapos.recipe.dcron:Part'
,
'davstorage = slapos.recipe.davstorage:Recipe'
,
'downloader = slapos.recipe.downloader:Recipe'
,
'dropbear = slapos.recipe.dropbear:Recipe'
,
'dropbear.add_authorized_key = slapos.recipe.dropbear:AddAuthorizedKey'
,
'dropbear.client = slapos.recipe.dropbear:Client'
,
...
...
slapos/recipe/downloader.py
deleted
100644 → 0
View file @
601eee69
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
os
import
urllib
import
hashlib
import
tempfile
import
shutil
import
subprocess
from
slapos.recipe.librecipe
import
GenericBaseRecipe
BUFFER_SIZE
=
1024
# XXX-Cedric: For god's sake, why do we always reinvent the wheel???
# DON'T use this and use h.r.download, except if you need the "confirm" feature.
# XXX-Cedric: implement "confirm" feature in h.r.download
def
service
(
args
):
environ
=
os
.
environ
.
copy
()
environ
.
update
(
PATH
=
args
[
'path'
])
if
not
os
.
path
.
exists
(
args
[
'confirm'
]):
tmpdir
=
tempfile
.
mkdtemp
()
try
:
# XXX: Hardcoded path
tmpoutput
=
os
.
path
.
join
(
tmpdir
,
'downloaded'
)
urllib
.
urlretrieve
(
args
[
'url'
],
tmpoutput
)
if
args
[
'md5'
]
is
not
None
:
# XXX: we need to find a better way to do a md5sum
md5sum
=
hashlib
.
md5
()
with
open
(
args
[
'output'
],
'r'
)
as
output
:
file_buffer
=
output
.
read
(
BUFFER_SIZE
)
while
len
(
file_buffer
)
>
0
:
md5sum
.
update
(
file_buffer
)
file_buffer
=
output
.
read
(
BUFFER_SIZE
)
if
args
[
'md5'
]
!=
md5sum
.
hexdigest
():
return
127
# Not-null return code
if
not
args
[
'archive'
]:
shutil
.
move
(
tmpoutput
,
args
[
'output'
])
else
:
# XXX: hardcoding path
extract_dir
=
os
.
path
.
join
(
tmpdir
,
'extract'
)
os
.
mkdir
(
extract_dir
)
subprocess
.
check_call
(
[
'tar'
,
'-x'
,
'-f'
,
tmpoutput
,
'-C'
,
extract_dir
,
],
env
=
environ
,
)
archive_content
=
os
.
listdir
(
extract_dir
)
if
len
(
archive_content
)
==
1
and
\
os
.
path
.
isfile
(
os
.
path
.
join
(
extract_dir
,
archive_content
[
0
])):
shutil
.
move
(
os
.
path
.
join
(
extract_dir
,
archive_content
[
0
]),
args
[
'output'
])
else
:
return
127
# Not-null return code
finally
:
shutil
.
rmtree
(
tmpdir
)
# Just a touch on args['confirm'] file
open
(
args
[
'confirm'
],
'w'
).
close
()
return
0
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
path_list
=
[]
md5sum
=
self
.
options
.
get
(
'md5sum'
,
''
)
if
len
(
md5sum
)
==
0
:
md5sum
=
None
keywords
=
{
'url'
:
self
.
options
[
'url'
],
'md5'
:
md5sum
,
'output'
:
self
.
options
[
'downloaded-file'
],
'confirm'
:
self
.
options
[
'downloaded-file-complete'
],
'archive'
:
self
.
optionIsTrue
(
'archive'
,
False
),
}
if
keywords
[
'archive'
]:
keywords
[
'path'
]
=
self
.
options
[
'path'
]
path_list
.
append
(
self
.
createPythonScript
(
self
.
options
[
'binary'
],
'slapos.recipe.downloader.service'
,
keywords
,
)
)
return
path_list
software/unstable/lxc/software.cfg
View file @
942bac49
...
...
@@ -65,5 +65,8 @@ eggs =
slapos.toolbox
[versions]
# if you upgrade to >1.0.29 this recipe may break
# as slapos.cookbook:downloader was removed.
slapos.cookbook = 0.64.1
slapos.toolbox = 0.30
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment