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

Remove specific cache naming.

parent 37efda8d
......@@ -396,8 +396,8 @@ class Buildout(UserDict.DictMixin):
newest=self.newest,
allow_hosts=self._allow_hosts,
prefer_final=not self.accept_buildout_test_releases,
sha_cache=self.download_cache_url,
sha_dir=self.download_dir_url,
download_cache_url=self.download_cache_url,
download_dir_url=self.download_dir_url,
)
# Now copy buildout and setuptools eggs, and record destination eggs:
......@@ -899,8 +899,8 @@ class Buildout(UserDict.DictMixin):
path = [options['develop-eggs-directory']],
allow_hosts = self._allow_hosts,
prefer_final=not self.accept_buildout_test_releases,
sha_cache=self.download_cache_url,
sha_dir=self.download_dir_url,
download_cache_url=self.download_cache_url,
download_dir_url=self.download_dir_url,
)
upgraded = []
......@@ -1129,8 +1129,8 @@ def _install_and_load(spec, group, entry, buildout):
newest=buildout.newest,
allow_hosts=buildout._allow_hosts,
prefer_final=not buildout.accept_buildout_test_releases,
sha_cache=self.download_cache_url,
sha_dir=self.download_dir_url)
download_cache_url=self.download_cache_url,
download_dir_url=self.download_dir_url)
__doing__ = 'Loading %s recipe entry %s:%s.', group, spec, entry
return pkg_resources.load_entry_point(
......
......@@ -71,8 +71,8 @@ class Download(object):
self.fallback = fallback
self.hash_name = hash_name
self.logger = logger or logging.getLogger('zc.buildout')
self.sha_dir = options.get('sha-dir')
self.sha_cache = options.get('sha-cache')
self.download_dir_url = options.get('sha-dir')
self.download_cache_url = options.get('sha-cache')
@property
def download_cache(self):
......@@ -178,7 +178,7 @@ class Download(object):
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):
# Download from original url
......@@ -187,7 +187,7 @@ class Download(object):
raise ChecksumError(
'MD5 checksum mismatch downloading %r' % url)
# 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)
finally:
os.close(handle)
......
......@@ -341,8 +341,8 @@ class Installer:
include_site_packages=None,
allowed_eggs_from_site_packages=None,
prefer_final=None,
sha_dir=None,
sha_cache=None
download_dir_url=None,
download_cache_url=None
):
self._dest = dest
self._allow_hosts = allow_hosts
......@@ -411,8 +411,8 @@ class Installer:
if versions is not None:
self._versions = versions
self._sha_dir = sha_dir
self._sha_cache = sha_cache
self._download_dir_url = download_dir_url
self._download_cache_url = download_cache_url
_allowed_eggs_from_site_packages_regex = None
def allow_site_package_egg(self, name):
......@@ -715,10 +715,10 @@ class Installer:
filename = get_filename_from_url(dist.location)
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 = 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)
if (download_cache
......@@ -1098,13 +1098,13 @@ def install(specs, dest,
path=None, working_set=None, newest=True, versions=None,
use_dependency_links=None, allow_hosts=('*',),
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(
dest, links, index, executable, always_unzip, path, newest,
versions, use_dependency_links, allow_hosts=allow_hosts,
include_site_packages=include_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)
......
......@@ -51,7 +51,7 @@ def get_directory_key(url):
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
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):
if not LIBNETWORKCACHE_ENABLED:
return False
if sha_cache in (None, '',):
if download_cache_url in (None, '',):
# Not able to use network cache
return False
if md5sum is 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)
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)
f = open(path, 'w+b')
......@@ -95,12 +95,12 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
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"""
if not LIBNETWORKCACHE_ENABLED:
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(
'Upload cache ignored, shacache or shadir was not provided!')
return False
......@@ -112,8 +112,8 @@ def upload_network_cached(sha_cache, sha_dir, external_url, path, logger):
f = open(path, 'r')
try:
nc = NetworkcacheClient(shacache=sha_cache,
shadir=sha_dir)
nc = NetworkcacheClient(shacache=download_cache_url,
shadir=download_dir_url)
data = nc.upload(f, directory_key, **kw)
except (IOError, UploadError), e:
logger.info('Fail to upload file. %s' % \
......
......@@ -89,9 +89,9 @@ class Eggs(object):
if 'unzip' in options:
kw['always_unzip'] = options.query_bool('unzip', None)
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:
kw['sha_dir'] = b_options.get('sha-dir')
kw['download_dir_url'] = b_options.get('sha-dir')
ws = zc.buildout.easy_install.install(
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