| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Contains generating and parsing systems of the Chromium Buildbot Annotator. | 6 """Contains generating and parsing systems of the Chromium Buildbot Annotator. |
| 7 | 7 |
| 8 When executed as a script, this reads step name / command pairs from a file and | 8 When executed as a script, this reads step name / command pairs from a file and |
| 9 executes those lines while annotating the output. The input is json: | 9 executes those lines while annotating the output. The input is json: |
| 10 | 10 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 builder_name = trig.get('builder_name') | 450 builder_name = trig.get('builder_name') |
| 451 if not builder_name: | 451 if not builder_name: |
| 452 raise ValueError('Trigger spec: builder_name is not set') | 452 raise ValueError('Trigger spec: builder_name is not set') |
| 453 | 453 |
| 454 changes = trig.get('buildbot_changes', []) | 454 changes = trig.get('buildbot_changes', []) |
| 455 assert isinstance(changes, list), 'buildbot_changes must be a list' | 455 assert isinstance(changes, list), 'buildbot_changes must be a list' |
| 456 changes = map(normalizeChange, changes) | 456 changes = map(normalizeChange, changes) |
| 457 | 457 |
| 458 step.step_trigger(json.dumps({ | 458 step.step_trigger(json.dumps({ |
| 459 'builderNames': [builder_name], | 459 'builderNames': [builder_name], |
| 460 'bucket': trig.get('bucket'), |
| 460 'changes': changes, | 461 'changes': changes, |
| 461 'properties': trig.get('properties'), | 462 'properties': trig.get('properties'), |
| 462 }, sort_keys=True)) | 463 }, sort_keys=True)) |
| 463 | 464 |
| 464 | 465 |
| 465 def run_step(stream, name, cmd, | 466 def run_step(stream, name, cmd, |
| 466 cwd=None, env=None, | 467 cwd=None, env=None, |
| 467 allow_subannotations=False, | 468 allow_subannotations=False, |
| 468 trigger_specs=None, | 469 trigger_specs=None, |
| 469 **kwargs): | 470 **kwargs): |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 steps.extend(json.load(sys.stdin, object_hook=force_dict_strs)) | 665 steps.extend(json.load(sys.stdin, object_hook=force_dict_strs)) |
| 665 else: | 666 else: |
| 666 with open(args[0], 'rb') as f: | 667 with open(args[0], 'rb') as f: |
| 667 steps.extend(json.load(f, object_hook=force_dict_strs)) | 668 steps.extend(json.load(f, object_hook=force_dict_strs)) |
| 668 | 669 |
| 669 return 1 if run_steps(steps, False)[0] else 0 | 670 return 1 if run_steps(steps, False)[0] else 0 |
| 670 | 671 |
| 671 | 672 |
| 672 if __name__ == '__main__': | 673 if __name__ == '__main__': |
| 673 sys.exit(main()) | 674 sys.exit(main()) |
| OLD | NEW |