| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The LUCI Authors. All rights reserved. | 2 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Tool to interact with recipe repositories. | 6 """Tool to interact with recipe repositories. |
| 7 | 7 |
| 8 This tool operates on the nearest ancestor directory containing an | 8 This tool operates on the nearest ancestor directory containing an |
| 9 infra/config/recipes.cfg. | 9 infra/config/recipes.cfg. |
| 10 """ | 10 """ |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 os.makedirs(workdir) | 150 os.makedirs(workdir) |
| 151 | 151 |
| 152 old_cwd = os.getcwd() | 152 old_cwd = os.getcwd() |
| 153 os.chdir(workdir) | 153 os.chdir(workdir) |
| 154 stream_engine = stream.ProductStreamEngine( | 154 stream_engine = stream.ProductStreamEngine( |
| 155 stream.StreamEngineInvariants(), | 155 stream.StreamEngineInvariants(), |
| 156 stream.AnnotatorStreamEngine( | 156 stream.AnnotatorStreamEngine( |
| 157 sys.stdout, emit_timestamps=(args.timestamps or | 157 sys.stdout, emit_timestamps=(args.timestamps or |
| 158 op_args.annotation_flags.emit_timestamp))) | 158 op_args.annotation_flags.emit_timestamp))) |
| 159 with stream_engine: | 159 with stream_engine: |
| 160 # Emit initial properties if configured to do so. |
| 161 if op_args.annotation_flags.emit_initial_properties: |
| 162 with stream_engine.new_step_stream('Initial Properties') as s: |
| 163 for key in sorted(properties.iterkeys()): |
| 164 s.set_build_property(key, json.dumps(properties[key], sort_keys=True)) |
| 165 |
| 160 try: | 166 try: |
| 161 ret = recipe_run.run_steps( | 167 ret = recipe_run.run_steps( |
| 162 properties, stream_engine, | 168 properties, stream_engine, |
| 163 step_runner.SubprocessStepRunner(stream_engine), | 169 step_runner.SubprocessStepRunner(stream_engine), |
| 164 universe_view=universe_view) | 170 universe_view=universe_view) |
| 165 finally: | 171 finally: |
| 166 os.chdir(old_cwd) | 172 os.chdir(old_cwd) |
| 167 | 173 |
| 168 return handle_recipe_return(ret, args.output_result_json, stream_engine) | 174 return handle_recipe_return(ret, args.output_result_json, stream_engine) |
| 169 | 175 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 ret = main() | 566 ret = main() |
| 561 if not isinstance(ret, int): | 567 if not isinstance(ret, int): |
| 562 if ret is None: | 568 if ret is None: |
| 563 ret = 0 | 569 ret = 0 |
| 564 else: | 570 else: |
| 565 print >> sys.stderr, ret | 571 print >> sys.stderr, ret |
| 566 ret = 1 | 572 ret = 1 |
| 567 sys.stdout.flush() | 573 sys.stdout.flush() |
| 568 sys.stderr.flush() | 574 sys.stderr.flush() |
| 569 os._exit(ret) | 575 os._exit(ret) |
| OLD | NEW |