summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2018-07-26 17:55:43 +0100
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-07-29 07:52:06 +0000
commitcb8c99e52a713abfee18c4cce9893c6371df0bbf (patch)
treefbab499adcdc66e2cb4a77c25a6efd8b5a0c9a18
parent32ddb5443f1c35074dfd60df82c6b3ec03ffa253 (diff)
downloadbuildstream-cb8c99e52a713abfee18c4cce9893c6371df0bbf.tar.gz
buildelement.py: Only display one activity message (#507)
-rw-r--r--buildstream/buildelement.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/buildstream/buildelement.py b/buildstream/buildelement.py
index ec05acbeb..c0fef8cdb 100644
--- a/buildstream/buildelement.py
+++ b/buildstream/buildelement.py
@@ -1,5 +1,6 @@
#
# Copyright (C) 2016 Codethink Limited
+# Copyright (C) 2018 Bloomberg Finance LP
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -204,8 +205,9 @@ class BuildElement(Element):
def prepare(self, sandbox):
commands = self.__commands['configure-commands']
if commands:
- for cmd in commands:
- self.__run_command(sandbox, cmd, 'configure-commands')
+ with self.timed_activity("Running configure-commands"):
+ for cmd in commands:
+ self.__run_command(sandbox, cmd, 'configure-commands')
def generate_script(self):
script = ""
@@ -231,13 +233,12 @@ class BuildElement(Element):
return commands
def __run_command(self, sandbox, cmd, cmd_name):
- with self.timed_activity("Running {}".format(cmd_name)):
- self.status("Running {}".format(cmd_name), 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'],
- SandboxFlags.ROOT_READ_ONLY)
- if exitcode != 0:
- raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode))
+ self.status("Running {}".format(cmd_name), 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'],
+ SandboxFlags.ROOT_READ_ONLY)
+ if exitcode != 0:
+ raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode))