Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.build
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
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
f36d8db4
Commit
f36d8db4
authored
Aug 13, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support new integrity option to replace md5sum
parent
6d809e51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
9 deletions
+21
-9
README.rst
README.rst
+9
-5
slapos/recipe/download.py
slapos/recipe/download.py
+6
-2
slapos/recipe/downloadunpacked.py
slapos/recipe/downloadunpacked.py
+6
-2
No files found.
README.rst
View file @
f36d8db4
...
@@ -27,11 +27,11 @@ Example that installs software::
...
@@ -27,11 +27,11 @@ Example that installs software::
statlib:lib/libfoo.a
statlib:lib/libfoo.a
statlib:lib/libfoo.la
statlib:lib/libfoo.la
dynlib:bin/foo linked:libbar.so.1,libc.so.6,libfoo.so.1 rpath:${bar:location}/lib,!/lib
dynlib:bin/foo linked:libbar.so.1,libc.so.6,libfoo.so.1 rpath:${bar:location}/lib,!/lib
x86 = http://host/path/x86.zip [
md5sum
]
x86 = http://host/path/x86.zip [
hashes
]
x86-64 = http://host/path/x64.zip [
md5sum
]
x86-64 = http://host/path/x64.zip [
hashes
]
install =
install =
url,
md5sum
= options[guessPlatform()].split()
url,
hashes
= options[guessPlatform()].split()
extract_dir = self.extract(self.download(url,
md5sum
))
extract_dir = self.extract(self.download(url,
hashes=hashes
))
self.copyTree(guessworkdir(extract_dir), location)
self.copyTree(guessworkdir(extract_dir), location)
${:update}
${:update}
update =
update =
...
@@ -134,7 +134,11 @@ filename parameter can be used to change destination named filename.
...
@@ -134,7 +134,11 @@ filename parameter can be used to change destination named filename.
destination parameter allows to put explicit destination.
destination parameter allows to put explicit destination.
md5sum parameter allows pass md5sum.
integrity parameter allow to specify the expected hashes for the downloaded
file, in a format ``algorithm:hash``
md5sum parameter allows pass md5sum. This is deprecated, integrity is
recommended instead.
mode (octal, so for rw-r--r-- use 0644) allows to set mode
mode (octal, so for rw-r--r-- use 0644) allows to set mode
...
...
slapos/recipe/download.py
View file @
f36d8db4
...
@@ -40,6 +40,7 @@ class Recipe(object):
...
@@ -40,6 +40,7 @@ class Recipe(object):
self
.
_downloader
=
zc
.
buildout
.
download
.
Download
(
buildout_section
,
self
.
_downloader
=
zc
.
buildout
.
download
.
Download
(
buildout_section
,
hash_name
=
True
)
hash_name
=
True
)
self
.
_url
=
options
[
'url'
]
self
.
_url
=
options
[
'url'
]
self
.
_integrity
=
options
.
get
(
'integrity'
)
self
.
_md5sum
=
options
.
get
(
'md5sum'
)
self
.
_md5sum
=
options
.
get
(
'md5sum'
)
self
.
_name
=
name
self
.
_name
=
name
mode
=
options
.
get
(
'mode'
)
mode
=
options
.
get
(
'mode'
)
...
@@ -92,7 +93,10 @@ class Recipe(object):
...
@@ -92,7 +93,10 @@ class Recipe(object):
if
parts
is
not
None
and
not
os
.
path
.
isdir
(
parts
):
if
parts
is
not
None
and
not
os
.
path
.
isdir
(
parts
):
os
.
mkdir
(
parts
)
os
.
mkdir
(
parts
)
result
.
append
(
parts
)
result
.
append
(
parts
)
path
,
is_temp
=
self
.
_downloader
(
self
.
_url
,
md5sum
=
self
.
_md5sum
)
if
self
.
_integrity
:
path
,
is_temp
=
self
.
_downloader
(
self
.
_url
,
hashes
=
self
.
_integrity
)
else
:
path
,
is_temp
=
self
.
_downloader
(
self
.
_url
,
md5sum
=
self
.
_md5sum
)
with
open
(
path
,
'rb'
)
as
fsrc
:
with
open
(
path
,
'rb'
)
as
fsrc
:
if
is_temp
:
if
is_temp
:
os
.
remove
(
path
)
os
.
remove
(
path
)
...
@@ -112,5 +116,5 @@ class Recipe(object):
...
@@ -112,5 +116,5 @@ class Recipe(object):
return
result
return
result
def
update
(
self
):
def
update
(
self
):
if
not
self
.
_md5sum
:
if
not
(
self
.
_md5sum
or
self
.
_integrity
)
:
self
.
install
()
self
.
install
()
slapos/recipe/downloadunpacked.py
View file @
f36d8db4
...
@@ -108,8 +108,12 @@ class Recipe:
...
@@ -108,8 +108,12 @@ class Recipe:
extract_dir
=
tempfile
.
mkdtemp
(
self
.
name
)
extract_dir
=
tempfile
.
mkdtemp
(
self
.
name
)
try
:
try
:
self
.
logger
.
debug
(
'Created working directory %r'
,
extract_dir
)
self
.
logger
.
debug
(
'Created working directory %r'
,
extract_dir
)
path
,
is_temp
=
download
(
self
.
options
[
'url'
],
if
self
.
options
.
get
(
'integrity'
):
md5sum
=
self
.
options
.
get
(
'md5sum'
))
path
,
is_temp
=
download
(
self
.
options
[
'url'
],
hashes
=
self
.
options
[
'integrity'
])
else
:
path
,
is_temp
=
download
(
self
.
options
[
'url'
],
md5sum
=
self
.
options
.
get
(
'md5sum'
))
try
:
try
:
patch_archive_util
()
patch_archive_util
()
# ad-hoc support for .xz and .lz archive
# ad-hoc support for .xz and .lz archive
...
...
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