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

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

Issue 1356603003: Revert of RELAND of Cross-repo recipe package system. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « infra/config/recipes.cfg ('k') | scripts/slave/bot_update.py » ('j') | 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 import contextlib 6 import contextlib
7 import json 7 import json
8 import optparse 8 import optparse
9 import os 9 import os
10 import subprocess 10 import subprocess
11 import sys 11 import sys
12 import tempfile 12 import tempfile
13 13
14 BUILD_ROOT = os.path.dirname(os.path.dirname(os.path.dirname( 14 BUILD_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(
15 os.path.abspath(__file__)))) 15 os.path.abspath(__file__))))
16 sys.path.append(os.path.join(BUILD_ROOT, 'scripts')) 16 sys.path.append(os.path.join(BUILD_ROOT, 'scripts'))
17 sys.path.append(os.path.join(BUILD_ROOT, 'third_party')) 17 sys.path.append(os.path.join(BUILD_ROOT, 'third_party'))
18 18
19 from common import annotator 19 from common import annotator
20 from common import chromium_utils 20 from common import chromium_utils
21 from common import master_cfg_utils 21 from common import master_cfg_utils
22 from slave import recipe_universe
22 23
23 SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__)) 24 from recipe_engine import main as recipe_main
24 BUILD_LIMITED_ROOT = os.path.join(
25 os.path.dirname(BUILD_ROOT), 'build_internal', 'scripts', 'slave')
26
27 PACKAGE_CFG = os.path.join(
28 os.path.dirname(os.path.dirname(SCRIPT_PATH)),
29 'infra', 'config', 'recipes.cfg')
30 25
31 @contextlib.contextmanager 26 @contextlib.contextmanager
32 def namedTempFile(): 27 def namedTempFile():
33 fd, name = tempfile.mkstemp() 28 fd, name = tempfile.mkstemp()
34 os.close(fd) # let the exceptions fly 29 os.close(fd) # let the exceptions fly
35 try: 30 try:
36 yield name 31 yield name
37 finally: 32 finally:
38 try: 33 try:
39 os.remove(name) 34 os.remove(name)
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 os.environ['PYTHONIOENCODING'] = 'UTF-8' 197 os.environ['PYTHONIOENCODING'] = 'UTF-8'
203 198
204 return True 199 return True
205 200
206 201
207 def main(argv): 202 def main(argv):
208 opts, _ = get_args(argv) 203 opts, _ = get_args(argv)
209 properties = get_recipe_properties( 204 properties = get_recipe_properties(
210 opts.factory_properties, opts.build_properties, 205 opts.factory_properties, opts.build_properties,
211 opts.master_overrides_slave) 206 opts.master_overrides_slave)
212 207 stream = annotator.StructuredAnnotationStream()
213 # Find out if the recipe we intend to run is in build_internal's recipes. If 208 ret = recipe_main.run_steps(properties, stream,
214 # so, use recipes.py from there, otherwise use the one from build. 209 universe=recipe_universe.get_universe())
215 recipe_file = properties['recipe'].replace('/', os.path.sep) + '.py' 210 return ret.status_code
216 if os.path.exists(os.path.join(BUILD_LIMITED_ROOT, 'recipes', recipe_file)):
217 recipe_runner = os.path.join(BUILD_LIMITED_ROOT, 'recipes.py')
218 else:
219 recipe_runner = os.path.join(SCRIPT_PATH, 'recipes.py')
220
221 with namedTempFile() as props_file:
222 with open(props_file, 'w') as fh:
223 fh.write(json.dumps(properties))
224 cmd = [
225 sys.executable, '-u', recipe_runner,
226 'run',
227 '--workdir=%s' % os.getcwd(),
228 '--properties-file=%s' % props_file,
229 properties['recipe'] ]
230 return subprocess.call(cmd)
231 211
232 212
233 def shell_main(argv): 213 def shell_main(argv):
234 if update_scripts(): 214 if update_scripts():
235 return subprocess.call([sys.executable] + argv) 215 return subprocess.call([sys.executable] + argv)
236 else: 216 else:
237 return main(argv) 217 return main(argv)
238 218
239
240 if __name__ == '__main__': 219 if __name__ == '__main__':
241 sys.exit(shell_main(sys.argv)) 220 sys.exit(shell_main(sys.argv))
OLDNEW
« 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