summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-06-10 12:18:13 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-06-10 12:18:13 +0100
commit29c836174baff2b6fa02d8ce7109ff656c4d4834 (patch)
tree9d89c9d87a8a86d73b03d3a9c4d2cacf697de24b
parent92547c0203a5b676020dd1f6816022454607c7b4 (diff)
downloadmorph-29c836174baff2b6fa02d8ce7109ff656c4d4834.tar.gz
Fix up sam/remote-artifact-cache-failure branch after review
-rw-r--r--morphlib/buildcommand.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index 222b7127..5abef54c 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -284,6 +284,12 @@ class BuildCommand(object):
self.app.status_prefix = old_prefix
def cache_or_build_artifact(self, artifact, build_env):
+ '''Make the built artifact available in the local cache.
+
+ This can be done by retrieving from a remote artifact cache, or if
+ that doesn't work for some reason, by building the artifact locally.
+
+ '''
if self.rac is not None:
try:
self.cache_artifacts_locally([artifact])
@@ -397,13 +403,14 @@ class BuildCommand(object):
try:
for remote, local in to_fetch:
shutil.copyfileobj(remote, local)
- for remote, local in to_fetch:
- remote.close()
- local.close()
except BaseException:
for remote, local in to_fetch:
local.abort()
raise
+ else:
+ for remote, local in to_fetch:
+ remote.close()
+ local.close()
for artifact in artifacts:
to_fetch = []