Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: scripts/slave/annotated_run.py

Issue 860383008: Made annotated_run look up recipe from builders.pyl masters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scripts/common/chromium_utils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 309
310 ret = run_steps(stream, opts.build_properties, opts.factory_properties) 310 ret = run_steps(stream, opts.build_properties, opts.factory_properties)
311 return ret.status_code 311 return ret.status_code
312 312
313 313
314 # Return value of run_steps and RecipeEngine.run. 314 # Return value of run_steps and RecipeEngine.run.
315 RecipeExecutionResult = collections.namedtuple( 315 RecipeExecutionResult = collections.namedtuple(
316 'RecipeExecutionResult', 'status_code steps_ran') 316 'RecipeExecutionResult', 'status_code steps_ran')
317 317
318 318
319 def find_recipe(build_properties):
iannucci 2015/02/03 22:29:23 trick: def find_recipe(recipe=None, mastername=
320 """Finds the recipe to run from build_properties.
321
322 If it is not in build_properties, tries to find it in builders.pyl of the
323 master. Mutates build_properties to include it in this case.
324 """
325 if 'recipe' in build_properties:
326 return build_properties['recipe']
327
328 master_path = chromium_utils.MasterPath(build_properties['mastername'])
329 builders_file = os.path.join(master_path, 'builders.pyl')
330 if os.path.isfile(builders_file):
331 builders = chromium_utils.ReadBuildersFile(builders_file)
332 builder = builders['builders'][build_properties['buildername']]
iannucci 2015/02/03 22:29:23 this could raise if ['builders'] doesn't have the
333 recipe = builder['recipe']
334 build_properties['recipe'] = recipe
iannucci 2015/02/03 22:29:23 /me flips out nooooo!!!!! caller should modify bu
335 return recipe
iannucci 2015/02/03 22:29:23 TODO: also return builders['builders'][buildername
336
337 raise LookupError('Cannot find recipe for %s on %s' %
338 (build_properties['buildername'],
339 build_properties['mastername']))
340
341
319 def run_steps(stream, build_properties, factory_properties, 342 def run_steps(stream, build_properties, factory_properties,
320 test_data=recipe_test_api.DisabledTestData()): 343 test_data=recipe_test_api.DisabledTestData()):
321 """Returns a tuple of (status_code, steps_ran). 344 """Returns a tuple of (status_code, steps_ran).
322 345
323 Only one of these values will be set at a time. This is mainly to support the 346 Only one of these values will be set at a time. This is mainly to support the
324 testing interface used by unittests/recipes_test.py. 347 testing interface used by unittests/recipes_test.py.
325 """ 348 """
326 stream.honor_zero_return_code() 349 stream.honor_zero_return_code()
327 350
328 # TODO(iannucci): Stop this when blamelist becomes sane data. 351 # TODO(iannucci): Stop this when blamelist becomes sane data.
(...skipping 22 matching lines...) Expand all
351 # It's an integration point with a new recipe engine that can run steps 374 # It's an integration point with a new recipe engine that can run steps
352 # in parallel (that is not implemented yet). Use new engine only if explicitly 375 # in parallel (that is not implemented yet). Use new engine only if explicitly
353 # asked by setting 'engine' property to 'ParallelRecipeEngine'. 376 # asked by setting 'engine' property to 'ParallelRecipeEngine'.
354 engine = RecipeEngine.create(stream, properties, test_data) 377 engine = RecipeEngine.create(stream, properties, test_data)
355 378
356 # Create all API modules and an instance of top level GenSteps generator. 379 # Create all API modules and an instance of top level GenSteps generator.
357 # It doesn't launch any recipe code yet (generator needs to be iterated upon 380 # It doesn't launch any recipe code yet (generator needs to be iterated upon
358 # to start executing code). 381 # to start executing code).
359 api = None 382 api = None
360 with stream.step('setup_build') as s: 383 with stream.step('setup_build') as s:
361 assert 'recipe' in factory_properties 384 recipe = find_recipe(build_properties)
362 recipe = factory_properties['recipe']
363 385
364 properties_to_print = properties.copy() 386 properties_to_print = properties.copy()
365 if 'use_mirror' in properties: 387 if 'use_mirror' in properties:
366 del properties_to_print['use_mirror'] 388 del properties_to_print['use_mirror']
367 389
368 run_recipe_help_lines = [ 390 run_recipe_help_lines = [
369 'To repro this locally, run the following line from a build checkout:', 391 'To repro this locally, run the following line from a build checkout:',
370 '', 392 '',
371 './scripts/tools/run_recipe.py %s --properties-file - <<EOF' % recipe, 393 './scripts/tools/run_recipe.py %s --properties-file - <<EOF' % recipe,
372 repr(properties_to_print), 394 repr(properties_to_print),
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 685
664 def shell_main(argv): 686 def shell_main(argv):
665 if update_scripts(): 687 if update_scripts():
666 return subprocess.call([sys.executable] + argv) 688 return subprocess.call([sys.executable] + argv)
667 else: 689 else:
668 return main(argv) 690 return main(argv)
669 691
670 692
671 if __name__ == '__main__': 693 if __name__ == '__main__':
672 sys.exit(shell_main(sys.argv)) 694 sys.exit(shell_main(sys.argv))
OLDNEW
« no previous file with comments | « scripts/common/chromium_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698