summaryrefslogtreecommitdiff
path: root/morphlib/builder2.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-17 16:09:21 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-17 16:35:24 +0100
commiteb97755f15c992419deb7be9b173d6a85e9a3353 (patch)
treeedcfaef9d85af5e7f0cb52f5a3d406aa7d7f4797 /morphlib/builder2.py
parent5e317fab29c08c71f2292185716e37fe4419c125 (diff)
downloadmorph-eb97755f15c992419deb7be9b173d6a85e9a3353.tar.gz
Log to morph's log output of a failed build
Normally, the build log would go into the artifact cache, but it's tedious to fetch from there, so we log it into the normal morph log as well if things fail.
Diffstat (limited to 'morphlib/builder2.py')
-rw-r--r--morphlib/builder2.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index 03a62144..a5f86e8d 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -249,6 +249,7 @@ class ChunkBuilder(BuilderBase):
def build_and_cache(self): # pragma: no cover
with self.build_watch('overall-build'):
mounted = self.do_mounts()
+ log_name = None
try:
builddir = self.staging_area.builddir(self.artifact.source)
self.get_sources(builddir)
@@ -256,9 +257,15 @@ class ChunkBuilder(BuilderBase):
with self.local_artifact_cache.put_source_metadata(
self.artifact.source, self.artifact.cache_key,
'build-log') as log:
+ log_name = log._savefile_filename
self.run_commands(builddir, destdir, log)
except:
self.do_unmounts(mounted)
+ if log_name:
+ with open(log_name) as f:
+ for line in f:
+ logging.error('OUTPUT FROM FAILED BUILD: %s' %
+ line.rstrip('\n'))
raise
self.do_unmounts(mounted)
built_artifacts = self.assemble_chunk_artifacts(destdir)