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
Xavier Thompson
slapos.buildout
Commits
12706228
Commit
12706228
authored
Jan 19, 2012
by
Yingjie Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Uses binary cache."
This reverts commit
f18c3b61
.
parent
f18c3b61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
29 deletions
+9
-29
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+9
-29
No files found.
src/zc/buildout/networkcache.py
View file @
12706228
...
@@ -20,14 +20,6 @@ import re
...
@@ -20,14 +20,6 @@ import re
import
shutil
import
shutil
import
urlparse
import
urlparse
import
traceback
import
traceback
import
ctypes
from
ctypes
import
util
SYS
,
_
,
KERNEL
,
_
,
ARCH
=
os
.
uname
()
LIBC
=
ctypes
.
cdll
.
LoadLibrary
(
ctypes
.
util
.
find_library
(
'c'
))
LIBC_VERSION_FUN
=
LIBC
.
gnu_get_libc_version
LIBC_VERSION_FUN
.
restype
=
ctypes
.
c_char_p
LIBC_VERSION
=
"libc-%s"
%
LIBC_VERSION_FUN
()
try
:
try
:
try
:
try
:
...
@@ -84,7 +76,7 @@ def get_directory_key(url):
...
@@ -84,7 +76,7 @@ def get_directory_key(url):
@
fallback_call
@
fallback_call
def
download_network_cached
(
dir_url
,
cache_url
,
path
,
url
,
logger
,
def
download_network_cached
(
dir_url
,
cache_url
,
path
,
url
,
logger
,
signature_certificate_list
,
md5sum
=
None
,
binary_mode
=
False
):
signature_certificate_list
,
md5sum
=
None
):
"""Downloads from a network cache provider
"""Downloads from a network cache provider
If something fail (providor be offline, or hash_string fail), we ignore
If something fail (providor be offline, or hash_string fail), we ignore
...
@@ -100,12 +92,8 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
...
@@ -100,12 +92,8 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
if
md5sum
is
None
:
if
md5sum
is
None
:
md5sum
=
_get_md5_from_url
(
url
)
md5sum
=
_get_md5_from_url
(
url
)
if
binary_mode
:
directory_key
=
"binary-%s-%s-%s"
%
\
(
os
.
path
.
basename
(
path
),
SYS
,
ARCH
)
else
:
directory_key
=
get_directory_key
(
url
)
directory_key
=
get_directory_key
(
url
)
url
=
os
.
path
.
basename
(
url
)
url
=
os
.
path
.
basename
(
url
)
if
len
(
signature_certificate_list
)
==
0
:
if
len
(
signature_certificate_list
)
==
0
:
...
@@ -120,7 +108,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
...
@@ -120,7 +108,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
logger
.
info
(
'Downloading %s from network cache.'
%
url
)
logger
.
info
(
'Downloading %s from network cache.'
%
url
)
try
:
try
:
file_descriptor
=
nc
.
select
(
directory_key
,
binary_mode
=
binary_mode
)
file_descriptor
=
nc
.
select
(
directory_key
)
f
=
open
(
path
,
'w+b'
)
f
=
open
(
path
,
'w+b'
)
try
:
try
:
...
@@ -143,7 +131,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
...
@@ -143,7 +131,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
@
fallback_call
@
fallback_call
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
,
shacache_cert_file
,
shacache_key_file
,
signature_private_key_file
,
shacache_cert_file
,
shacache_key_file
,
shadir_cert_file
,
shadir_key_file
,
binary_mode
=
False
):
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
...
@@ -153,19 +141,11 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
...
@@ -153,19 +141,11 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
logger
.
info
(
'Uploading %s into network cache.'
%
external_url
)
logger
.
info
(
'Uploading %s into network cache.'
%
external_url
)
if
binary_mode
:
file_name
=
get_filename_from_url
(
external_url
)
file_name
=
get_filename_from_url
(
path
)
directory_key
=
"binary-%s-%s-%s"
%
\
directory_key
=
get_directory_key
(
external_url
)
(
file_name
,
SYS
,
ARCH
)
kw
=
dict
(
file_name
=
file_name
,
kw
=
dict
(
file_name
=
file_name
,
urlmd5
=
hashlib
.
md5
(
external_url
).
hexdigest
())
kernel
=
KERNEL
,
libc_version
=
LIBC_VERSION
,
urlmd5
=
hashlib
.
md5
(
external_url
).
hexdigest
())
else
:
file_name
=
get_filename_from_url
(
external_url
)
directory_key
=
get_directory_key
(
external_url
)
kw
=
dict
(
file_name
=
file_name
,
urlmd5
=
hashlib
.
md5
(
external_url
).
hexdigest
())
f
=
open
(
path
,
'r'
)
f
=
open
(
path
,
'r'
)
# convert '' into None in order to call nc nicely
# convert '' into None in order to call nc nicely
...
...
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