summaryrefslogtreecommitdiff
path: root/buildstream/scriptelement.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2018-06-04 18:12:56 +0100
committerknownexus <phillip.smyth@codethink.co.uk>2018-07-31 17:32:35 +0100
commitd14d8ee29b5fcaadcfd05934de71b46221243fcd (patch)
tree20af5e9ad76c01c56b72e0a8362549c3b57f5d82 /buildstream/scriptelement.py
parent553df1084dc0b2b10fb13b00549aa358eb1049bb (diff)
downloadbuildstream-d14d8ee29b5fcaadcfd05934de71b46221243fcd.tar.gz
Cache failed builds
This creates an artifact when element assembly fails too, and if it's the right kind of exception uses the now-included install directory similarly to if it had returned successfully. If there's a failure during install the artifact contains any installed files, but may contain nothing at all.
Diffstat (limited to 'buildstream/scriptelement.py')
-rw-r--r--buildstream/scriptelement.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/buildstream/scriptelement.py b/buildstream/scriptelement.py
index 46afda807..145dc2648 100644
--- a/buildstream/scriptelement.py
+++ b/buildstream/scriptelement.py
@@ -277,7 +277,8 @@ class ScriptElement(Element):
exitcode = sandbox.run(['sh', '-c', '-e', cmd + '\n'],
SandboxFlags.ROOT_READ_ONLY if self.__root_read_only else 0)
if exitcode != 0:
- raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode))
+ raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode),
+ collect=self.__install_root)
# Return where the result can be collected from
return self.__install_root