Skip to content
Snippets Groups Projects
Commit 73dec86e authored by Jürg Billeter's avatar Jürg Billeter
Browse files

scriptelement.py: Support batching for integration and build commands

parent 63db90b2
No related branches found
No related tags found
Loading
......@@ -226,6 +226,7 @@ class ScriptElement(Element):
.format(build_dep.name), silent_nested=True):
build_dep.stage_dependency_artifacts(sandbox, Scope.RUN, path="/")
with sandbox.batch(SandboxFlags.NONE):
for build_dep in self.dependencies(Scope.BUILD, recurse=False):
with self.timed_activity("Integrating {}".format(build_dep.name), silent_nested=True):
for dep in build_dep.dependencies(Scope.RUN):
......@@ -251,6 +252,7 @@ class ScriptElement(Element):
virtual_dstdir.descend(item['destination'].lstrip(os.sep).split(os.sep), create=True)
element.stage_dependency_artifacts(sandbox, Scope.RUN, path=item['destination'])
with sandbox.batch(SandboxFlags.NONE):
for item in self.__layout:
# Skip layout members which dont stage an element
......@@ -275,16 +277,15 @@ class ScriptElement(Element):
if self.__root_read_only:
flags |= SandboxFlags.ROOT_READ_ONLY
with sandbox.batch(flags, collect=self.__install_root):
for groupname, commands in self.__commands.items():
with self.timed_activity("Running '{}'".format(groupname)):
with sandbox.batch(flags, label="Running '{}'".format(groupname)):
for cmd in commands:
self.status("Running command", detail=cmd)
# Note the -e switch to 'sh' means to exit with an error
# if any untested command fails.
exitcode = sandbox.run(['sh', '-c', '-e', cmd + '\n'], flags)
if exitcode != 0:
raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode),
collect=self.__install_root)
sandbox.run(['sh', '-c', '-e', cmd + '\n'],
flags,
label=cmd)
# Return where the result can be collected from
return self.__install_root
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment