[Notes] [Git][BuildStream/buildstream][master] 2 commits: buildelement.py: Only display one activity message (#507)



Title: GitLab

Tristan Van Berkom pushed to branch master at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/buildelement.py
    1 1
     #
    
    2 2
     #  Copyright (C) 2016 Codethink Limited
    
    3
    +#  Copyright (C) 2018 Bloomberg Finance LP
    
    3 4
     #
    
    4 5
     #  This program is free software; you can redistribute it and/or
    
    5 6
     #  modify it under the terms of the GNU Lesser General Public
    
    ... ... @@ -204,8 +205,9 @@ class BuildElement(Element):
    204 205
         def prepare(self, sandbox):
    
    205 206
             commands = self.__commands['configure-commands']
    
    206 207
             if commands:
    
    207
    -            for cmd in commands:
    
    208
    -                self.__run_command(sandbox, cmd, 'configure-commands')
    
    208
    +            with self.timed_activity("Running configure-commands"):
    
    209
    +                for cmd in commands:
    
    210
    +                    self.__run_command(sandbox, cmd, 'configure-commands')
    
    209 211
     
    
    210 212
         def generate_script(self):
    
    211 213
             script = ""
    
    ... ... @@ -231,13 +233,12 @@ class BuildElement(Element):
    231 233
             return commands
    
    232 234
     
    
    233 235
         def __run_command(self, sandbox, cmd, cmd_name):
    
    234
    -        with self.timed_activity("Running {}".format(cmd_name)):
    
    235
    -            self.status("Running {}".format(cmd_name), detail=cmd)
    
    236
    -
    
    237
    -            # Note the -e switch to 'sh' means to exit with an error
    
    238
    -            # if any untested command fails.
    
    239
    -            #
    
    240
    -            exitcode = sandbox.run(['sh', '-c', '-e', cmd + '\n'],
    
    241
    -                                   SandboxFlags.ROOT_READ_ONLY)
    
    242
    -            if exitcode != 0:
    
    243
    -                raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode))
    236
    +        self.status("Running {}".format(cmd_name), detail=cmd)
    
    237
    +
    
    238
    +        # Note the -e switch to 'sh' means to exit with an error
    
    239
    +        # if any untested command fails.
    
    240
    +        #
    
    241
    +        exitcode = sandbox.run(['sh', '-c', '-e', cmd + '\n'],
    
    242
    +                               SandboxFlags.ROOT_READ_ONLY)
    
    243
    +        if exitcode != 0:
    
    244
    +            raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode))



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]