Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
6
Merge Requests
6
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.buildout
Commits
6e4b8efe
Commit
6e4b8efe
authored
Oct 18, 2015
by
Kazuhiko Shiozaki
Committed by
Julien Muchembled
Dec 04, 2019
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support network cache in Download.download().
parent
970ffc9e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
360 additions
and
4 deletions
+360
-4
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+27
-0
src/zc/buildout/download.py
src/zc/buildout/download.py
+25
-4
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+308
-0
No files found.
src/zc/buildout/buildout.py
View file @
6e4b8efe
...
...
@@ -164,6 +164,8 @@ _buildout_default_options = _annotate_section({
'use-dependency-links'
:
'true'
,
},
'DEFAULT_VALUE'
)
network_cache_parameter_dict
=
{}
class
Buildout
(
DictMixin
):
def
__init__
(
self
,
config_file
,
cloptions
,
...
...
@@ -421,6 +423,31 @@ class Buildout(DictMixin):
os
.
chdir
(
options
[
'directory'
])
networkcache_section_name
=
options
.
get
(
'networkcache-section'
)
if
networkcache_section_name
:
networkcache_section
=
self
[
networkcache_section_name
]
for
k
in
(
'download-cache-url'
,
'download-dir-url'
,
'upload-cache-url'
,
'upload-dir-url'
,
'signature-certificate-list'
,
'signature-private-key-file'
,
'shacache-ca-file'
,
'shacache-cert-file'
,
'shacache-key-file'
,
'shadir-ca-file'
,
'shadir-cert-file'
,
'shadir-key-file'
,
):
network_cache_parameter_dict
[
k
]
=
networkcache_section
.
get
(
k
,
''
)
# parse signature list
cert_marker
=
'-----BEGIN CERTIFICATE-----'
network_cache_parameter_dict
[
'signature-certificate-list'
]
=
\
[
cert_marker
+
'
\
n
'
+
q
.
strip
()
\
for
q
in
network_cache_parameter_dict
[
'signature-certificate-list'
].
split
(
cert_marker
)
\
if
q
.
strip
()]
def
_buildout_path
(
self
,
name
):
if
'${'
in
name
:
return
name
...
...
src/zc/buildout/download.py
View file @
6e4b8efe
...
...
@@ -204,10 +204,29 @@ class Download(object):
handle
,
tmp_path
=
tempfile
.
mkstemp
(
prefix
=
'buildout-'
)
os
.
close
(
handle
)
try
:
tmp_path
,
headers
=
urlretrieve
(
url
,
tmp_path
)
if
not
check_md5sum
(
tmp_path
,
md5sum
):
raise
ChecksumError
(
'MD5 checksum mismatch downloading %r'
%
url
)
from
.buildout
import
network_cache_parameter_dict
as
nc
if
not
download_network_cached
(
nc
.
get
(
'download-dir-url'
),
nc
.
get
(
'download-cache-url'
),
tmp_path
,
url
,
self
.
logger
,
nc
.
get
(
'signature-certificate-list'
),
md5sum
):
# Download from original url if not cached or md5sum doesn't match.
tmp_path
,
headers
=
urlretrieve
(
url
,
tmp_path
)
if
not
check_md5sum
(
tmp_path
,
md5sum
):
raise
ChecksumError
(
'MD5 checksum mismatch downloading %r'
%
url
)
# Upload the file to network cache.
if
nc
.
get
(
'upload-cache-url'
)
and
nc
.
get
(
'upload-dir-url'
):
upload_network_cached
(
nc
.
get
(
'upload-dir-url'
),
nc
.
get
(
'upload-cache-url'
),
url
,
tmp_path
,
self
.
logger
,
nc
.
get
(
'signature-private-key-file'
),
nc
.
get
(
'shacache-ca-file'
),
nc
.
get
(
'shacache-cert-file'
),
nc
.
get
(
'shacache-key-file'
),
nc
.
get
(
'shadir-ca-file'
),
nc
.
get
(
'shadir-cert-file'
),
nc
.
get
(
'shadir-key-file'
))
except
IOError
:
e
=
sys
.
exc_info
()[
1
]
os
.
remove
(
tmp_path
)
...
...
@@ -276,6 +295,8 @@ def remove(path):
if
os
.
path
.
exists
(
path
):
os
.
remove
(
path
)
from
zc.buildout.networkcache
import
download_network_cached
,
\
upload_network_cached
def
locate_at
(
source
,
dest
):
if
dest
is
None
or
realpath
(
dest
)
==
realpath
(
source
):
...
...
src/zc/buildout/networkcache.py
0 → 100644
View file @
6e4b8efe
This diff is collapsed.
Click to expand it.
Julien Muchembled
@jm
mentioned in commit
1cc13345
·
Mar 09, 2022
mentioned in commit
1cc13345
mentioned in commit 1cc13345068351e8c6151e3e3e964131cac97c87
Toggle commit list
Julien Muchembled
@jm
mentioned in commit
47ab68e0
·
Mar 14, 2022
mentioned in commit
47ab68e0
mentioned in commit 47ab68e047d4a7c6f079631bd1ef33b34061304d
Toggle commit list
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