summaryrefslogtreecommitdiff
path: root/morphlib/util.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-10-29 11:45:42 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-10-29 12:21:45 +0000
commit479e23084983471de3be33547bf85840c8ad8f45 (patch)
treed74acb5bcad5311d6468ac42545d939d625ab52d /morphlib/util.py
parent644d71bae111c7d2f3dc23cdccf68941d66505ff (diff)
downloadmorph-479e23084983471de3be33547bf85840c8ad8f45.tar.gz
Add --artifact-cache-server and --git-resolve-cache-server
Diffstat (limited to 'morphlib/util.py')
-rw-r--r--morphlib/util.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/morphlib/util.py b/morphlib/util.py
index 1ccb0949..04df0633 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -81,6 +81,22 @@ def create_cachedir(settings): # pragma: no cover
return cachedir
+def get_artifact_cache_server(settings): # pragma: no cover
+ if settings['artifact-cache-server']:
+ return settings['artifact-cache-server']
+ if settings['cache-server']:
+ return settings['cache-server']
+ return None
+
+
+def get_git_resolve_cache_server(settings): # pragma: no cover
+ if settings['git-resolve-cache-server']:
+ return settings['git-resolve-cache-server']
+ if settings['cache-server']:
+ return settings['cache-server']
+ return None
+
+
def new_artifact_caches(settings): # pragma: no cover
'''Create new objects for local and remote artifact caches.
@@ -95,7 +111,7 @@ def new_artifact_caches(settings): # pragma: no cover
lac = morphlib.localartifactcache.LocalArtifactCache(artifact_cachedir)
- rac_url = settings['cache-server']
+ rac_url = get_artifact_cache_server(settings)
if rac_url:
rac = morphlib.remoteartifactcache.RemoteArtifactCache(rac_url)
else:
@@ -162,7 +178,7 @@ def new_repo_caches(app): # pragma: no cover
lrc = morphlib.localrepocache.LocalRepoCache(
app, gits_dir, repo_resolver, tarball_base_url=tarball_base_url)
- url = app.settings['cache-server']
+ url = get_git_resolve_cache_server(app.settings)
if url:
rrc = morphlib.remoterepocache.RemoteRepoCache(url, repo_resolver)
else: