Index: scripts/slave/annotated_run.py |
diff --git a/scripts/slave/annotated_run.py b/scripts/slave/annotated_run.py |
index 0f1f33d7c959278bf1d26301245e1cdca37067d5..fc6f2aaa5ab3ee70d25a7605de54050f720424bb 100755 |
--- a/scripts/slave/annotated_run.py |
+++ b/scripts/slave/annotated_run.py |
@@ -316,6 +316,29 @@ RecipeExecutionResult = collections.namedtuple( |
'RecipeExecutionResult', 'status_code steps_ran') |
+def find_recipe(build_properties): |
iannucci
2015/02/03 22:29:23
trick:
def find_recipe(recipe=None, mastername=
|
+ """Finds the recipe to run from build_properties. |
+ |
+ If it is not in build_properties, tries to find it in builders.pyl of the |
+ master. Mutates build_properties to include it in this case. |
+ """ |
+ if 'recipe' in build_properties: |
+ return build_properties['recipe'] |
+ |
+ master_path = chromium_utils.MasterPath(build_properties['mastername']) |
+ builders_file = os.path.join(master_path, 'builders.pyl') |
+ if os.path.isfile(builders_file): |
+ builders = chromium_utils.ReadBuildersFile(builders_file) |
+ builder = builders['builders'][build_properties['buildername']] |
iannucci
2015/02/03 22:29:23
this could raise if ['builders'] doesn't have the
|
+ recipe = builder['recipe'] |
+ build_properties['recipe'] = recipe |
iannucci
2015/02/03 22:29:23
/me flips out
nooooo!!!!! caller should modify bu
|
+ return recipe |
iannucci
2015/02/03 22:29:23
TODO: also return builders['builders'][buildername
|
+ |
+ raise LookupError('Cannot find recipe for %s on %s' % |
+ (build_properties['buildername'], |
+ build_properties['mastername'])) |
+ |
+ |
def run_steps(stream, build_properties, factory_properties, |
test_data=recipe_test_api.DisabledTestData()): |
"""Returns a tuple of (status_code, steps_ran). |
@@ -358,8 +381,7 @@ def run_steps(stream, build_properties, factory_properties, |
# to start executing code). |
api = None |
with stream.step('setup_build') as s: |
- assert 'recipe' in factory_properties |
- recipe = factory_properties['recipe'] |
+ recipe = find_recipe(build_properties) |
properties_to_print = properties.copy() |
if 'use_mirror' in properties: |