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 """Entry point for fully-annotated builds. | 6 """Entry point for fully-annotated builds. |
7 | 7 |
8 This script is part of the effort to move all builds to annotator-based | 8 This script is part of the effort to move all builds to annotator-based |
9 systems. Any builder configured to use the AnnotatorFactory.BaseFactory() | 9 systems. Any builder configured to use the AnnotatorFactory.BaseFactory() |
10 found in scripts/master/factory/annotator_factory.py executes a single | 10 found in scripts/master/factory/annotator_factory.py executes a single |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 continue | 109 continue |
110 ret.append(item) | 110 ret.append(item) |
111 return ret | 111 return ret |
112 | 112 |
113 | 113 |
114 def fixup_seed_steps(sequence): | 114 def fixup_seed_steps(sequence): |
115 """Takes a sequence of step dict's and adds seed_steps to the first entry | 115 """Takes a sequence of step dict's and adds seed_steps to the first entry |
116 if appropriate.""" | 116 if appropriate.""" |
117 if sequence and 'seed_steps' not in sequence[0]: | 117 if sequence and 'seed_steps' not in sequence[0]: |
118 sequence[0]['seed_steps'] = [x['name'] for x in sequence] | 118 sequence[0]['seed_steps'] = [x['name'] for x in sequence] |
| 119 for other in sequence[1:]: |
| 120 other['seed_steps'] = [] |
119 | 121 |
120 | 122 |
121 def ensure_sequence_of_steps(step_or_steps): | 123 def ensure_sequence_of_steps(step_or_steps): |
122 """Generates one or more fixed steps, given a step or a sequence of steps.""" | 124 """Generates one or more fixed steps, given a step or a sequence of steps.""" |
123 if isinstance(step_or_steps, collections.Sequence): | 125 if isinstance(step_or_steps, collections.Sequence): |
124 step_seq = step_or_steps | 126 step_seq = step_or_steps |
125 fixup_seed_steps(step_seq) | 127 fixup_seed_steps(step_seq) |
126 for s in step_seq: | 128 for s in step_seq: |
127 yield s | 129 yield s |
128 else: | 130 else: |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 new_cmd.append(item) | 285 new_cmd.append(item) |
284 step['cmd'] = new_cmd | 286 step['cmd'] = new_cmd |
285 if 'cwd' in step: | 287 if 'cwd' in step: |
286 [new_cwd] = expand_root_placeholder(root, [step['cwd']]) | 288 [new_cwd] = expand_root_placeholder(root, [step['cwd']]) |
287 step['cwd'] = new_cwd | 289 step['cwd'] = new_cwd |
288 | 290 |
289 json_data = step.pop('static_json_data', {}) | 291 json_data = step.pop('static_json_data', {}) |
290 assert not(json_data and json_output_name), ( | 292 assert not(json_data and json_output_name), ( |
291 "Cannot have both static_json_data as well as dynamic json_data") | 293 "Cannot have both static_json_data as well as dynamic json_data") |
292 if test_data is None: | 294 if test_data is None: |
293 failed, [retcode] = annotator.run_steps([step], failed) | 295 # Manually mangae seed_steps because annotator.py doesn't have enough |
| 296 # context |
| 297 seed_steps = step.pop('seed_steps') |
| 298 failed, [retcode] = annotator.run_steps([step], failed, seed_steps) |
294 if json_output_name: | 299 if json_output_name: |
295 try: | 300 try: |
296 json_data = json.load(os.fdopen(json_output_fd, 'r')) | 301 json_data = json.load(os.fdopen(json_output_fd, 'r')) |
297 except ValueError: | 302 except ValueError: |
298 pass | 303 pass |
299 else: | 304 else: |
300 retcode, potential_json_data = test_data.pop(step['name'], (0, {})) | 305 retcode, potential_json_data = test_data.pop(step['name'], (0, {})) |
301 json_data = json_data or potential_json_data | 306 json_data = json_data or potential_json_data |
302 failed = failed or retcode != 0 | 307 failed = failed or retcode != 0 |
303 | 308 |
(...skipping 24 matching lines...) Expand all Loading... |
328 s.step_text('gclient sync failed!') | 333 s.step_text('gclient sync failed!') |
329 s.step_warnings() | 334 s.step_warnings() |
330 os.environ['RUN_SLAVE_UPDATED_SCRIPTS'] = '1' | 335 os.environ['RUN_SLAVE_UPDATED_SCRIPTS'] = '1' |
331 return True | 336 return True |
332 | 337 |
333 | 338 |
334 if __name__ == '__main__': | 339 if __name__ == '__main__': |
335 if UpdateScripts(): | 340 if UpdateScripts(): |
336 os.execv(sys.executable, [sys.executable] + sys.argv) | 341 os.execv(sys.executable, [sys.executable] + sys.argv) |
337 sys.exit(main(sys.argv)) | 342 sys.exit(main(sys.argv)) |
OLD | NEW |