diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-07-29 21:14:43 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-07-29 21:14:43 +0000 |
commit | a4c9e5b2c1032eaebecc59a7ebf455bcabd7f0f6 (patch) | |
tree | 6d1366d3dcea9dcd0066af44fe8b07caf37eba63 | |
parent | 55aacefaf7d87374c76793c3ff0147f03fc8c0b3 (diff) | |
parent | 12fea82e12a27eccb34ef4efbaa7c6874787eb4c (diff) | |
download | buildstream-a4c9e5b2c1032eaebecc59a7ebf455bcabd7f0f6.tar.gz |
Merge branch 'tristan/backport-logline-dups-1.2' into 'bst-1.2'
buildelement.py: Only display one activity message (#507)
See merge request BuildStream/buildstream!586
-rw-r--r-- | buildstream/buildelement.py | 25 |
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)) |