Commit 73b544e5 authored by Łukasz Nowak's avatar Łukasz Nowak

Remove specific cache naming.

parent 37efda8d
...@@ -396,8 +396,8 @@ class Buildout(UserDict.DictMixin): ...@@ -396,8 +396,8 @@ class Buildout(UserDict.DictMixin):
newest=self.newest, newest=self.newest,
allow_hosts=self._allow_hosts, allow_hosts=self._allow_hosts,
prefer_final=not self.accept_buildout_test_releases, prefer_final=not self.accept_buildout_test_releases,
sha_cache=self.download_cache_url, download_cache_url=self.download_cache_url,
sha_dir=self.download_dir_url, download_dir_url=self.download_dir_url,
) )
# Now copy buildout and setuptools eggs, and record destination eggs: # Now copy buildout and setuptools eggs, and record destination eggs:
...@@ -899,8 +899,8 @@ class Buildout(UserDict.DictMixin): ...@@ -899,8 +899,8 @@ class Buildout(UserDict.DictMixin):
path = [options['develop-eggs-directory']], path = [options['develop-eggs-directory']],
allow_hosts = self._allow_hosts, allow_hosts = self._allow_hosts,
prefer_final=not self.accept_buildout_test_releases, prefer_final=not self.accept_buildout_test_releases,
sha_cache=self.download_cache_url, download_cache_url=self.download_cache_url,
sha_dir=self.download_dir_url, download_dir_url=self.download_dir_url,
) )
upgraded = [] upgraded = []
...@@ -1129,8 +1129,8 @@ def _install_and_load(spec, group, entry, buildout): ...@@ -1129,8 +1129,8 @@ def _install_and_load(spec, group, entry, buildout):
newest=buildout.newest, newest=buildout.newest,
allow_hosts=buildout._allow_hosts, allow_hosts=buildout._allow_hosts,
prefer_final=not buildout.accept_buildout_test_releases, prefer_final=not buildout.accept_buildout_test_releases,
sha_cache=self.download_cache_url, download_cache_url=self.download_cache_url,
sha_dir=self.download_dir_url) download_dir_url=self.download_dir_url)
__doing__ = 'Loading %s recipe entry %s:%s.', group, spec, entry __doing__ = 'Loading %s recipe entry %s:%s.', group, spec, entry
return pkg_resources.load_entry_point( return pkg_resources.load_entry_point(
......
...@@ -71,8 +71,8 @@ class Download(object): ...@@ -71,8 +71,8 @@ class Download(object):
self.fallback = fallback self.fallback = fallback
self.hash_name = hash_name self.hash_name = hash_name
self.logger = logger or logging.getLogger('zc.buildout') self.logger = logger or logging.getLogger('zc.buildout')
self.sha_dir = options.get('sha-dir') self.download_dir_url = options.get('sha-dir')
self.sha_cache = options.get('sha-cache') self.download_cache_url = options.get('sha-cache')
@property @property
def download_cache(self): def download_cache(self):
...@@ -178,7 +178,7 @@ class Download(object): ...@@ -178,7 +178,7 @@ class Download(object):
try: try:
try: try:
if not download_network_cached(self.sha_dir, self.sha_cache, if not download_network_cached(self.download_dir_url, self.download_cache_url,
tmp_path, url, self.logger, md5sum): tmp_path, url, self.logger, md5sum):
# Download from original url # Download from original url
...@@ -187,7 +187,7 @@ class Download(object): ...@@ -187,7 +187,7 @@ class Download(object):
raise ChecksumError( raise ChecksumError(
'MD5 checksum mismatch downloading %r' % url) 'MD5 checksum mismatch downloading %r' % url)
# Upload the file to networkcached. # Upload the file to networkcached.
upload_network_cached(self.sha_cache, self.sha_dir, url, upload_network_cached(self.download_cache_url, self.download_dir_url, url,
tmp_path, self.logger) tmp_path, self.logger)
finally: finally:
os.close(handle) os.close(handle)
......
...@@ -341,8 +341,8 @@ class Installer: ...@@ -341,8 +341,8 @@ class Installer:
include_site_packages=None, include_site_packages=None,
allowed_eggs_from_site_packages=None, allowed_eggs_from_site_packages=None,
prefer_final=None, prefer_final=None,
sha_dir=None, download_dir_url=None,
sha_cache=None download_cache_url=None
): ):
self._dest = dest self._dest = dest
self._allow_hosts = allow_hosts self._allow_hosts = allow_hosts
...@@ -411,8 +411,8 @@ class Installer: ...@@ -411,8 +411,8 @@ class Installer:
if versions is not None: if versions is not None:
self._versions = versions self._versions = versions
self._sha_dir = sha_dir self._download_dir_url = download_dir_url
self._sha_cache = sha_cache self._download_cache_url = download_cache_url
_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):
...@@ -715,10 +715,10 @@ class Installer: ...@@ -715,10 +715,10 @@ class Installer:
filename = get_filename_from_url(dist.location) filename = get_filename_from_url(dist.location)
new_location = os.path.join(tmp, filename) new_location = os.path.join(tmp, filename)
if not download_network_cached(self._sha_dir, self._sha_cache, if not download_network_cached(self._download_dir_url, self._download_cache_url,
new_location, dist.location, logger): new_location, dist.location, logger):
new_location = self._index.download(dist.location, tmp) new_location = self._index.download(dist.location, tmp)
upload_network_cached(self._sha_cache, self._sha_dir, upload_network_cached(self._download_cache_url, self._download_dir_url,
dist.location, new_location, logger) dist.location, new_location, logger)
if (download_cache if (download_cache
...@@ -1098,13 +1098,13 @@ def install(specs, dest, ...@@ -1098,13 +1098,13 @@ def install(specs, dest,
path=None, working_set=None, newest=True, versions=None, path=None, working_set=None, newest=True, versions=None,
use_dependency_links=None, allow_hosts=('*',), use_dependency_links=None, allow_hosts=('*',),
include_site_packages=None, allowed_eggs_from_site_packages=None, include_site_packages=None, allowed_eggs_from_site_packages=None,
prefer_final=None, sha_dir=None, sha_cache=None): prefer_final=None, download_dir_url=None, download_cache_url=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,
include_site_packages=include_site_packages, include_site_packages=include_site_packages,
allowed_eggs_from_site_packages=allowed_eggs_from_site_packages, allowed_eggs_from_site_packages=allowed_eggs_from_site_packages,
prefer_final=prefer_final, sha_dir=sha_dir, sha_cache=sha_cache) prefer_final=prefer_final, download_dir_url=download_dir_url, download_cache_url=download_cache_url)
return installer.install(specs, working_set) return installer.install(specs, working_set)
......
...@@ -51,7 +51,7 @@ def get_directory_key(url): ...@@ -51,7 +51,7 @@ def get_directory_key(url):
return 'slapos-buildout-%s' % urlmd5 return 'slapos-buildout-%s' % urlmd5
def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None): def download_network_cached(download_dir_url, download_cache_url, path, url, logger, 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
...@@ -62,7 +62,7 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None): ...@@ -62,7 +62,7 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
if not LIBNETWORKCACHE_ENABLED: if not LIBNETWORKCACHE_ENABLED:
return False return False
if sha_cache in (None, '',): if download_cache_url in (None, '',):
# Not able to use network cache # Not able to use network cache
return False return False
if md5sum is None: if md5sum is None:
...@@ -74,7 +74,7 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None): ...@@ -74,7 +74,7 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
logger.info('Downloading %s from network cache.' % file_name) logger.info('Downloading %s from network cache.' % file_name)
try: try:
nc = NetworkcacheClient(shacache=sha_cache, shadir=sha_dir) nc = NetworkcacheClient(shacache=download_cache_url, shadir=download_dir_url)
file_content = nc.select(directory_key) file_content = nc.select(directory_key)
f = open(path, 'w+b') f = open(path, 'w+b')
...@@ -95,12 +95,12 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None): ...@@ -95,12 +95,12 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
return True return True
def upload_network_cached(sha_cache, sha_dir, external_url, path, logger): def upload_network_cached(download_cache_url, download_dir_url, external_url, path, logger):
"""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
if sha_cache in [None, ''] or sha_dir in [None, '']: if download_cache_url in [None, ''] or download_dir_url in [None, '']:
logger.debug( logger.debug(
'Upload cache ignored, shacache or shadir was not provided!') 'Upload cache ignored, shacache or shadir was not provided!')
return False return False
...@@ -112,8 +112,8 @@ def upload_network_cached(sha_cache, sha_dir, external_url, path, logger): ...@@ -112,8 +112,8 @@ def upload_network_cached(sha_cache, sha_dir, external_url, path, logger):
f = open(path, 'r') f = open(path, 'r')
try: try:
nc = NetworkcacheClient(shacache=sha_cache, nc = NetworkcacheClient(shacache=download_cache_url,
shadir=sha_dir) shadir=download_dir_url)
data = nc.upload(f, directory_key, **kw) data = nc.upload(f, directory_key, **kw)
except (IOError, UploadError), e: except (IOError, UploadError), e:
logger.info('Fail to upload file. %s' % \ logger.info('Fail to upload file. %s' % \
......
...@@ -89,9 +89,9 @@ class Eggs(object): ...@@ -89,9 +89,9 @@ class Eggs(object):
if 'unzip' in options: if 'unzip' in options:
kw['always_unzip'] = options.query_bool('unzip', None) kw['always_unzip'] = options.query_bool('unzip', None)
if 'sha-cache' in b_options: if 'sha-cache' in b_options:
kw['sha_cache'] = b_options.get('sha-cache') kw['download_cache_url'] = b_options.get('sha-cache')
if 'sha-dir' in b_options: if 'sha-dir' in b_options:
kw['sha_dir'] = b_options.get('sha-dir') kw['download_dir_url'] = b_options.get('sha-dir')
ws = zc.buildout.easy_install.install( ws = zc.buildout.easy_install.install(
distributions, options['eggs-directory'], distributions, options['eggs-directory'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment