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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos.recipe.build
Commits
85eabd23
Commit
85eabd23
authored
Sep 17, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download*: new alternate-url option
parent
8a9e3766
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
README.rst
README.rst
+16
-0
slapos/recipe/download.py
slapos/recipe/download.py
+4
-1
slapos/recipe/downloadunpacked.py
slapos/recipe/downloadunpacked.py
+3
-1
No files found.
README.rst
View file @
85eabd23
...
@@ -339,6 +339,17 @@ In case of checksum mismatch::
...
@@ -339,6 +339,17 @@ In case of checksum mismatch::
Error: MD5 checksum mismatch downloading '...'
Error: MD5 checksum mismatch downloading '...'
>>> ls('parts')
>>> ls('parts')
option: alternate-url
---------------------
Alternate URL. If supported by Buildout, it is used as fallback if the main
URL (`url` option) fails at HTTP level.
Useful when a version of a resource can only be downloaded with a temporary
URL as long as it's the last version, and this version is then moved to a
permanent place when a newer version is released: `url` shall be the final URL
and `alternate-url` the temporary one.
option: mode
option: mode
------------
------------
...
@@ -462,6 +473,11 @@ option: md5sum
...
@@ -462,6 +473,11 @@ option: md5sum
An MD5 checksum can be specified to check the downloaded file, like for the
An MD5 checksum can be specified to check the downloaded file, like for the
``download`` recipe. However, if unset, updating the part does nothing.
``download`` recipe. However, if unset, updating the part does nothing.
option: alternate-url
---------------------
See the ``download`` recipe.
option: environment
option: environment
-------------------
-------------------
...
...
slapos/recipe/download.py
View file @
85eabd23
...
@@ -36,6 +36,7 @@ class Recipe(object):
...
@@ -36,6 +36,7 @@ class Recipe(object):
def
__init__
(
self
,
buildout
,
name
,
options
):
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
_buildout
=
buildout
[
'buildout'
]
self
.
_buildout
=
buildout
[
'buildout'
]
self
.
_url
=
options
[
'url'
]
self
.
_url
=
options
[
'url'
]
self
.
_alternate
=
options
.
get
(
'alternate-url'
)
self
.
_md5sum
=
options
.
get
(
'md5sum'
)
or
None
self
.
_md5sum
=
options
.
get
(
'md5sum'
)
or
None
self
.
_name
=
name
self
.
_name
=
name
mode
=
options
.
get
(
'mode'
)
mode
=
options
.
get
(
'mode'
)
...
@@ -72,8 +73,10 @@ class Recipe(object):
...
@@ -72,8 +73,10 @@ class Recipe(object):
return
[
destination
]
return
[
destination
]
def
_download
(
self
):
def
_download
(
self
):
alternate
=
self
.
_alternate
download
.
Download
(
self
.
_buildout
,
hash_name
=
True
)(
download
.
Download
(
self
.
_buildout
,
hash_name
=
True
)(
self
.
_url
,
self
.
_md5sum
,
self
.
_destination
)
self
.
_url
,
self
.
_md5sum
,
self
.
_destination
,
**
({
'alternate_url'
:
alternate
}
if
alternate
else
{}))
if
self
.
_mode
is
not
None
:
if
self
.
_mode
is
not
None
:
os
.
chmod
(
self
.
_destination
,
self
.
_mode
)
os
.
chmod
(
self
.
_destination
,
self
.
_mode
)
...
...
slapos/recipe/downloadunpacked.py
View file @
85eabd23
...
@@ -61,8 +61,10 @@ class Recipe(EnvironMixin):
...
@@ -61,8 +61,10 @@ class Recipe(EnvironMixin):
def
_install
(
self
):
def
_install
(
self
):
location
=
self
.
_shared
.
location
location
=
self
.
_shared
.
location
alternate
=
self
.
options
.
get
(
'alternate-url'
)
path
,
is_temp
=
download
.
Download
(
self
.
buildout
[
'buildout'
],
path
,
is_temp
=
download
.
Download
(
self
.
buildout
[
'buildout'
],
hash_name
=
True
)(
self
.
_url
,
self
.
options
.
get
(
'md5sum'
)
or
None
)
hash_name
=
True
)(
self
.
_url
,
self
.
options
.
get
(
'md5sum'
)
or
None
,
**
({
'alternate_url'
:
alternate
}
if
alternate
else
{}))
try
:
try
:
archive_util
.
extraction_drivers
=
patched_extraction_drivers
archive_util
.
extraction_drivers
=
patched_extraction_drivers
# 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