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

Unified Diff: scripts/slave/annotated_run.py

Issue 1241323004: Cross-repo recipe package system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Roll to latest recipes-py 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..d96a02192e431a495486253dd4a52f5c84f7cd76 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():
@@ -199,15 +204,46 @@ def update_scripts():
return True
+def clean_old_recipe_engine():
+ """Clean stale pycs from the old location of recipe_engine.
+
+ This function should only be needed for a little while after the recipe
+ packages rollout (2015-09-16).
+ """
+ for (dirpath, _, filenames) in os.walk(
+ os.path.join(BUILD_ROOT, 'third_party', 'recipe_engine')):
+ for filename in filenames:
+ if filename.endswith('.pyc'):
+ path = os.path.join(dirpath, filename)
+ os.remove(path)
+
+
def main(argv):
opts, _ = get_args(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
+
+ clean_old_recipe_engine()
+
+ # 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 +252,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