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
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
isaak yansane-sisk
slapos.buildout
Commits
c380b1ea
Commit
c380b1ea
authored
Aug 31, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support shacache and dir SSL based auth.
parent
7352fc86
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
9 deletions
+91
-9
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+36
-0
src/zc/buildout/download.py
src/zc/buildout/download.py
+13
-1
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+20
-4
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+16
-3
zc.recipe.egg_/src/zc/recipe/egg/egg.py
zc.recipe.egg_/src/zc/recipe/egg/egg.py
+6
-1
No files found.
src/zc/buildout/buildout.py
View file @
c380b1ea
...
@@ -355,6 +355,10 @@ class Buildout(UserDict.DictMixin):
...
@@ -355,6 +355,10 @@ class Buildout(UserDict.DictMixin):
self
.
upload_dir_url
=
None
self
.
upload_dir_url
=
None
self
.
signature_private_key_file
=
None
self
.
signature_private_key_file
=
None
self
.
signature_certificate_list
=
None
self
.
signature_certificate_list
=
None
self
.
shacache_cert_file
=
None
self
.
shacache_key_file
=
None
self
.
shadir_cert_file
=
None
self
.
shadir_key_file
=
None
else
:
else
:
# support networkcache
# support networkcache
networkcache_section_name
=
options
.
get
(
'networkcache-section'
)
networkcache_section_name
=
options
.
get
(
'networkcache-section'
)
...
@@ -372,6 +376,14 @@ class Buildout(UserDict.DictMixin):
...
@@ -372,6 +376,14 @@ class Buildout(UserDict.DictMixin):
'signature-certificate-list'
,
''
)
'signature-certificate-list'
,
''
)
self
.
signature_private_key_file
=
networkcache_section
.
get
(
self
.
signature_private_key_file
=
networkcache_section
.
get
(
'signature-private-key-file'
,
''
)
'signature-private-key-file'
,
''
)
self
.
shacache_cert_file
=
networkcache_section
.
get
(
'shacache-cert-file'
,
''
)
self
.
shacache_key_file
=
networkcache_section
.
get
(
'shacache-key-file'
,
''
)
self
.
shadir_cert_file
=
networkcache_section
.
get
(
'shadir-cert-file'
,
''
)
self
.
shadir_key_file
=
networkcache_section
.
get
(
'shadir-key-file'
,
''
)
# parse signature list
# parse signature list
cert_marker
=
'-----BEGIN CERTIFICATE-----'
cert_marker
=
'-----BEGIN CERTIFICATE-----'
...
@@ -391,6 +403,10 @@ class Buildout(UserDict.DictMixin):
...
@@ -391,6 +403,10 @@ class Buildout(UserDict.DictMixin):
options
[
'__networkcache__upload-dir-url'
]
=
self
.
upload_dir_url
options
[
'__networkcache__upload-dir-url'
]
=
self
.
upload_dir_url
options
[
'__networkcache__signature-certificate-list'
]
=
signature_certificate_list
options
[
'__networkcache__signature-certificate-list'
]
=
signature_certificate_list
options
[
'__networkcache__signature-private-key-file'
]
=
self
.
signature_private_key_file
options
[
'__networkcache__signature-private-key-file'
]
=
self
.
signature_private_key_file
options
[
'__networkcache__shacache-cert-file'
]
=
self
.
shacache_cert_file
options
[
'__networkcache__shacache-key-file'
]
=
self
.
shacache_key_file
options
[
'__networkcache__shadir-cert-file'
]
=
self
.
shadir_cert_file
options
[
'__networkcache__shadir-key-file'
]
=
self
.
shadir_key_file
else
:
else
:
self
.
_logger
.
debug
(
'Networkcache functionality not enabled. '
self
.
_logger
.
debug
(
'Networkcache functionality not enabled. '
...
@@ -401,6 +417,10 @@ class Buildout(UserDict.DictMixin):
...
@@ -401,6 +417,10 @@ class Buildout(UserDict.DictMixin):
self
.
upload_dir_url
=
None
self
.
upload_dir_url
=
None
self
.
signature_private_key_file
=
None
self
.
signature_private_key_file
=
None
self
.
signature_certificate_list
=
None
self
.
signature_certificate_list
=
None
self
.
shacache_cert_file
=
None
self
.
shacache_key_file
=
None
self
.
shadir_cert_file
=
None
self
.
shadir_key_file
=
None
def
_buildout_path
(
self
,
name
):
def
_buildout_path
(
self
,
name
):
if
'${'
in
name
:
if
'${'
in
name
:
...
@@ -442,6 +462,10 @@ class Buildout(UserDict.DictMixin):
...
@@ -442,6 +462,10 @@ class Buildout(UserDict.DictMixin):
upload_dir_url
=
self
.
upload_dir_url
,
upload_dir_url
=
self
.
upload_dir_url
,
signature_private_key_file
=
self
.
signature_private_key_file
,
signature_private_key_file
=
self
.
signature_private_key_file
,
signature_certificate_list
=
self
.
signature_certificate_list
,
signature_certificate_list
=
self
.
signature_certificate_list
,
shacache_cert_file
=
self
.
shacache_cert_file
,
shacache_key_file
=
self
.
shacache_key_file
,
shadir_cert_file
=
self
.
shadir_cert_file
,
shadir_key_file
=
self
.
shadir_key_file
,
)
)
# Now copy buildout and setuptools eggs, and record destination eggs:
# Now copy buildout and setuptools eggs, and record destination eggs:
...
@@ -954,6 +978,10 @@ class Buildout(UserDict.DictMixin):
...
@@ -954,6 +978,10 @@ class Buildout(UserDict.DictMixin):
upload_dir_url
=
self
.
upload_dir_url
,
upload_dir_url
=
self
.
upload_dir_url
,
signature_certificate_list
=
self
.
signature_certificate_list
,
signature_certificate_list
=
self
.
signature_certificate_list
,
signature_private_key_file
=
self
.
signature_private_key_file
,
signature_private_key_file
=
self
.
signature_private_key_file
,
shacache_cert_file
=
self
.
shacache_cert_file
,
shacache_key_file
=
self
.
shacache_key_file
,
shadir_cert_file
=
self
.
shadir_cert_file
,
shadir_key_file
=
self
.
shadir_key_file
,
)
)
upgraded
=
[]
upgraded
=
[]
...
@@ -1193,6 +1221,14 @@ def _install_and_load(spec, group, entry, buildout):
...
@@ -1193,6 +1221,14 @@ def _install_and_load(spec, group, entry, buildout):
'__networkcache__signature-private-key-file'
),
'__networkcache__signature-private-key-file'
),
signature_certificate_list
=
buildout_options
.
get
(
signature_certificate_list
=
buildout_options
.
get
(
'__networkcache__signature-certificate-list'
),
'__networkcache__signature-certificate-list'
),
shacache_cert_file
=
buildout_options
.
get
(
'__networkcache__shacache-cert-file'
),
shacache_key_file
=
buildout_options
.
get
(
'__networkcache__shacache-key-file'
),
shadir_cert_file
=
buildout_options
.
get
(
'__networkcache__shadir-cert-file'
),
shadir_key_file
=
buildout_options
.
get
(
'__networkcache__shadir-key-file'
),
)
)
__doing__
=
'Loading %s recipe entry %s:%s.'
,
group
,
spec
,
entry
__doing__
=
'Loading %s recipe entry %s:%s.'
,
group
,
spec
,
entry
...
...
src/zc/buildout/download.py
View file @
c380b1ea
...
@@ -86,6 +86,14 @@ class Download(object):
...
@@ -86,6 +86,14 @@ class Download(object):
if
q
.
strip
()]
if
q
.
strip
()]
self
.
signature_private_key_file
=
options
.
get
(
self
.
signature_private_key_file
=
options
.
get
(
'__networkcache__signature-private-key-file'
)
'__networkcache__signature-private-key-file'
)
self
.
shacache_cert_file
=
options
.
get
(
'__networkcache__shacache-cert-file'
)
self
.
shacache_key_file
=
options
.
get
(
'__networkcache__shacache-key-file'
)
self
.
shadir_cert_file
=
options
.
get
(
'__networkcache__shadir-cert-file'
)
self
.
shadir_key_file
=
options
.
get
(
'__networkcache__shadir-key-file'
)
@
property
@
property
def
download_cache
(
self
):
def
download_cache
(
self
):
...
@@ -203,7 +211,11 @@ class Download(object):
...
@@ -203,7 +211,11 @@ class Download(object):
if
self
.
upload_cache_url
and
self
.
upload_dir_url
:
if
self
.
upload_cache_url
and
self
.
upload_dir_url
:
upload_network_cached
(
self
.
upload_dir_url
,
upload_network_cached
(
self
.
upload_dir_url
,
self
.
upload_cache_url
,
url
,
tmp_path
,
self
.
logger
,
self
.
upload_cache_url
,
url
,
tmp_path
,
self
.
logger
,
self
.
signature_private_key_file
)
self
.
signature_private_key_file
,
self
.
shacache_cert_file
,
self
.
shacache_key_file
,
self
.
shadir_cert_file
,
self
.
shadir_key_file
)
finally
:
finally
:
os
.
close
(
handle
)
os
.
close
(
handle
)
except
:
except
:
...
...
src/zc/buildout/easy_install.py
View file @
c380b1ea
...
@@ -346,7 +346,11 @@ class Installer:
...
@@ -346,7 +346,11 @@ class Installer:
upload_dir_url
=
None
,
upload_dir_url
=
None
,
upload_cache_url
=
None
,
upload_cache_url
=
None
,
signature_certificate_list
=
None
,
signature_certificate_list
=
None
,
signature_private_key_file
=
None
signature_private_key_file
=
None
,
shacache_cert_file
=
None
,
shacache_key_file
=
None
,
shadir_cert_file
=
None
,
shadir_key_file
=
None
,
):
):
self
.
_dest
=
dest
self
.
_dest
=
dest
self
.
_allow_hosts
=
allow_hosts
self
.
_allow_hosts
=
allow_hosts
...
@@ -421,6 +425,10 @@ class Installer:
...
@@ -421,6 +425,10 @@ class Installer:
self
.
_upload_cache_url
=
upload_cache_url
self
.
_upload_cache_url
=
upload_cache_url
self
.
_signature_certificate_list
=
signature_certificate_list
self
.
_signature_certificate_list
=
signature_certificate_list
self
.
_signature_private_key_file
=
signature_private_key_file
self
.
_signature_private_key_file
=
signature_private_key_file
self
.
_shacache_cert_file
=
shacache_cert_file
self
.
_shacache_key_file
=
shacache_key_file
self
.
_shadir_cert_file
=
shadir_cert_file
self
.
_shadir_key_file
=
shadir_key_file
_allowed_eggs_from_site_packages_regex
=
None
_allowed_eggs_from_site_packages_regex
=
None
def
allow_site_package_egg
(
self
,
name
):
def
allow_site_package_egg
(
self
,
name
):
...
@@ -730,7 +738,9 @@ class Installer:
...
@@ -730,7 +738,9 @@ class Installer:
if
self
.
_upload_cache_url
and
self
.
_upload_dir_url
:
if
self
.
_upload_cache_url
and
self
.
_upload_dir_url
:
upload_network_cached
(
self
.
_upload_dir_url
,
upload_network_cached
(
self
.
_upload_dir_url
,
self
.
_upload_cache_url
,
dist
.
location
,
new_location
,
logger
,
self
.
_upload_cache_url
,
dist
.
location
,
new_location
,
logger
,
self
.
_signature_private_key_file
)
self
.
_signature_private_key_file
,
self
.
_shacache_cert_file
,
self
.
_shacache_key_file
,
self
.
_shadir_cert_file
,
self
.
_shadir_key_file
)
if
(
download_cache
if
(
download_cache
and
(
realpath
(
new_location
)
==
realpath
(
dist
.
location
))
and
(
realpath
(
new_location
)
==
realpath
(
dist
.
location
))
...
@@ -1111,7 +1121,9 @@ def install(specs, dest,
...
@@ -1111,7 +1121,9 @@ def install(specs, dest,
include_site_packages
=
None
,
allowed_eggs_from_site_packages
=
None
,
include_site_packages
=
None
,
allowed_eggs_from_site_packages
=
None
,
prefer_final
=
None
,
download_dir_url
=
None
,
download_cache_url
=
None
,
prefer_final
=
None
,
download_dir_url
=
None
,
download_cache_url
=
None
,
upload_dir_url
=
None
,
upload_cache_url
=
None
,
upload_dir_url
=
None
,
upload_cache_url
=
None
,
signature_certificate_list
=
None
,
signature_private_key_file
=
None
):
signature_certificate_list
=
None
,
signature_private_key_file
=
None
,
shacache_cert_file
=
None
,
shacache_key_file
=
None
,
shadir_cert_file
=
None
,
shadir_key_file
=
None
):
installer
=
Installer
(
installer
=
Installer
(
dest
,
links
,
index
,
executable
,
always_unzip
,
path
,
newest
,
dest
,
links
,
index
,
executable
,
always_unzip
,
path
,
newest
,
versions
,
use_dependency_links
,
allow_hosts
=
allow_hosts
,
versions
,
use_dependency_links
,
allow_hosts
=
allow_hosts
,
...
@@ -1121,7 +1133,11 @@ def install(specs, dest,
...
@@ -1121,7 +1133,11 @@ def install(specs, dest,
download_cache_url
=
download_cache_url
,
upload_dir_url
=
upload_dir_url
,
download_cache_url
=
download_cache_url
,
upload_dir_url
=
upload_dir_url
,
upload_cache_url
=
upload_cache_url
,
upload_cache_url
=
upload_cache_url
,
signature_certificate_list
=
signature_certificate_list
,
signature_certificate_list
=
signature_certificate_list
,
signature_private_key_file
=
signature_private_key_file
)
signature_private_key_file
=
signature_private_key_file
,
shacache_cert_file
=
shacache_cert_file
,
shacache_key_file
=
shacache_key_file
,
shadir_cert_file
=
shadir_cert_file
,
shadir_key_file
=
shadir_key_file
)
return
installer
.
install
(
specs
,
working_set
)
return
installer
.
install
(
specs
,
working_set
)
...
...
src/zc/buildout/networkcache.py
View file @
c380b1ea
...
@@ -105,7 +105,8 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
...
@@ -105,7 +105,8 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
def
upload_network_cached
(
dir_url
,
cache_url
,
external_url
,
path
,
logger
,
def
upload_network_cached
(
dir_url
,
cache_url
,
external_url
,
path
,
logger
,
signature_private_key_file
):
signature_private_key_file
,
shacache_cert_file
,
shacache_key_file
,
shadir_cert_file
,
shadir_key_file
):
"""Upload file to a network cache server"""
"""Upload file to a network cache server"""
if
not
LIBNETWORKCACHE_ENABLED
:
if
not
LIBNETWORKCACHE_ENABLED
:
return
False
return
False
...
@@ -122,12 +123,24 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
...
@@ -122,12 +123,24 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
urlmd5
=
hashlib
.
md5
(
external_url
).
hexdigest
())
urlmd5
=
hashlib
.
md5
(
external_url
).
hexdigest
())
f
=
open
(
path
,
'r'
)
f
=
open
(
path
,
'r'
)
# convert '' into None in order to call nc nicely
if
not
signature_private_key_file
:
if
not
signature_private_key_file
:
# convert '' into None in order to call nc nicely
signature_private_key_file
=
None
signature_private_key_file
=
None
if
not
shacache_cert_file
:
shacache_cert_file
=
None
if
not
shacache_key_file
:
shacache_key_file
=
None
if
not
shadir_cert_file
:
shadir_cert_file
=
None
if
not
shadir_key_file
:
shadir_key_file
=
None
try
:
try
:
nc
=
NetworkcacheClient
(
cache_url
,
dir_url
,
nc
=
NetworkcacheClient
(
cache_url
,
dir_url
,
signature_private_key_file
=
signature_private_key_file
)
signature_private_key_file
=
signature_private_key_file
,
shacache_cert_file
=
shacache_cert_file
,
shacache_key_file
=
shacache_key_file
,
shadir_cert_file
=
shadir_cert_file
,
shadir_key_file
=
shadir_key_file
)
except
TypeError
:
except
TypeError
:
logger
.
warning
(
'Incompatible version of networkcache, not using it.'
)
logger
.
warning
(
'Incompatible version of networkcache, not using it.'
)
return
False
return
False
...
...
zc.recipe.egg_/src/zc/recipe/egg/egg.py
View file @
c380b1ea
...
@@ -94,7 +94,12 @@ class Eggs(object):
...
@@ -94,7 +94,12 @@ class Eggs(object):
(
'__networkcache__upload-cache-url'
,
'upload_cache_url'
),
(
'__networkcache__upload-cache-url'
,
'upload_cache_url'
),
(
'__networkcache__upload-dir-url'
,
'upload_dir_url'
),
(
'__networkcache__upload-dir-url'
,
'upload_dir_url'
),
(
'__networkcache__signature-private-key-file'
,
'signature_private_key_file'
),
(
'__networkcache__signature-private-key-file'
,
'signature_private_key_file'
),
(
'__networkcache__signature-certificate-list'
,
'signature_certificate_list'
)):
(
'__networkcache__signature-certificate-list'
,
'signature_certificate_list'
),
(
'__networkcache__shacache-cert-file'
,
'shacache_cert_file'
),
(
'__networkcache__shacache-key-file'
,
'shacache_key_file'
),
(
'__networkcache__shadir-cert-file'
,
'shadir_cert_file'
),
(
'__networkcache__shadir-key-file'
,
'shadir_key_file'
),
):
if
option_key
in
b_options
:
if
option_key
in
b_options
:
if
option_key
==
'__networkcache__signature-certificate-list'
:
if
option_key
==
'__networkcache__signature-certificate-list'
:
cert_marker
=
'-----BEGIN CERTIFICATE-----'
cert_marker
=
'-----BEGIN CERTIFICATE-----'
...
...
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