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

Unified Diff: scripts/slave/annotated_run.py

Issue 1347273002: RELAND of Cross-repo recipe package system. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build@master
Patch Set: Rebase Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/config/recipes.cfg ('k') | scripts/slave/bot_update.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/annotated_run.py
diff --git a/scripts/slave/annotated_run.py b/scripts/slave/annotated_run.py
index 48df8ffa7436f09047eeba96de53e740b9dcf8be..514909168789ad1731201a6ad57f230db809d24f 100755
--- a/scripts/slave/annotated_run.py
+++ b/scripts/slave/annotated_run.py
@@ -19,9 +19,14 @@ sys.path.append(os.path.join(BUILD_ROOT, 'third_party'))
from common import annotator
from common import chromium_utils
from common import master_cfg_utils
-from slave import recipe_universe
-from recipe_engine import main as recipe_main
+SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
+BUILD_LIMITED_ROOT = os.path.join(
+ os.path.dirname(BUILD_ROOT), 'build_internal', 'scripts', 'slave')
+
+PACKAGE_CFG = os.path.join(
+ os.path.dirname(os.path.dirname(SCRIPT_PATH)),
+ 'infra', 'config', 'recipes.cfg')
@contextlib.contextmanager
def namedTempFile():
@@ -204,10 +209,25 @@ def main(argv):
properties = get_recipe_properties(
opts.factory_properties, opts.build_properties,
opts.master_overrides_slave)
- stream = annotator.StructuredAnnotationStream()
- ret = recipe_main.run_steps(properties, stream,
- universe=recipe_universe.get_universe())
- return ret.status_code
+
+ # Find out if the recipe we intend to run is in build_internal's recipes. If
+ # so, use recipes.py from there, otherwise use the one from build.
+ recipe_file = properties['recipe'].replace('/', os.path.sep) + '.py'
+ if os.path.exists(os.path.join(BUILD_LIMITED_ROOT, 'recipes', recipe_file)):
+ recipe_runner = os.path.join(BUILD_LIMITED_ROOT, 'recipes.py')
+ else:
+ recipe_runner = os.path.join(SCRIPT_PATH, 'recipes.py')
+
+ with namedTempFile() as props_file:
+ with open(props_file, 'w') as fh:
+ fh.write(json.dumps(properties))
+ cmd = [
+ sys.executable, '-u', recipe_runner,
+ 'run',
+ '--workdir=%s' % os.getcwd(),
+ '--properties-file=%s' % props_file,
+ properties['recipe'] ]
+ return subprocess.call(cmd)
def shell_main(argv):
@@ -216,5 +236,6 @@ def shell_main(argv):
else:
return main(argv)
+
if __name__ == '__main__':
sys.exit(shell_main(sys.argv))
« no previous file with comments | « infra/config/recipes.cfg ('k') | scripts/slave/bot_update.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698