From 29c836174baff2b6fa02d8ce7109ff656c4d4834 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 10 Jun 2014 12:18:13 +0100 Subject: Fix up sam/remote-artifact-cache-failure branch after review --- morphlib/buildcommand.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'morphlib') 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 = [] -- cgit v1.2.1