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

Unified Diff: scripts/slave/annotated_run.py

Issue 1869053002: kitchen_run: initial CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 4 years, 8 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
Index: scripts/slave/annotated_run.py
diff --git a/scripts/slave/annotated_run.py b/scripts/slave/annotated_run.py
index cb5b9a4c34e4ff57ad70f665356f2b7090324532..4739782dacd6a31293d406394f8b7957cba9038e 100755
--- a/scripts/slave/annotated_run.py
+++ b/scripts/slave/annotated_run.py
@@ -27,6 +27,7 @@ from common import env
from common import master_cfg_utils
from slave import gce
from slave import infra_platform
+from slave import update_scripts
iannucci 2016/04/11 18:07:28 this is a big enough change that it should be a se
dnj 2016/04/11 18:17:15 I'm a bit worried about this, as it makes our fund
dnj 2016/04/11 18:18:28 Actually WDYT about making this a standalone execu
Paweł Hajdan Jr. 2016/04/11 20:44:39 It will be - see my original comment, "I may extra
dnj 2016/04/12 21:22:21 It does. This is something I'm also not super happ
# Logging instance.
LOGGER = logging.getLogger('annotated_run')
@@ -765,75 +766,6 @@ def get_args(argv):
return parser.parse_args(argv)
-def update_scripts():
- if os.environ.get('RUN_SLAVE_UPDATED_SCRIPTS'):
- os.environ.pop('RUN_SLAVE_UPDATED_SCRIPTS')
- return False
-
- stream = annotator.StructuredAnnotationStream()
-
- with stream.step('update_scripts') as s:
- gclient_name = 'gclient'
- if sys.platform.startswith('win'):
- gclient_name += '.bat'
- gclient_path = os.path.join(env.Build, os.pardir, 'depot_tools',
- gclient_name)
- gclient_cmd = [gclient_path, 'sync', '--force', '--verbose', '--jobs=2',
- '--break_repo_locks']
- try:
- fd, output_json = tempfile.mkstemp()
- os.close(fd)
- gclient_cmd += ['--output-json', output_json]
- except Exception:
- # Super paranoia try block.
- output_json = None
- cmd_dict = {
- 'name': 'update_scripts',
- 'cmd': gclient_cmd,
- 'cwd': env.Build,
- }
- annotator.print_step(cmd_dict, os.environ, stream)
- rv, _ = _run_command(gclient_cmd, cwd=env.Build)
- if rv != 0:
- s.step_text('gclient sync failed!')
- s.step_exception()
- elif output_json:
- try:
- with open(output_json, 'r') as f:
- gclient_json = json.load(f)
- for line in json.dumps(
- gclient_json, sort_keys=True,
- indent=4, separators=(',', ': ')).splitlines():
- s.step_log_line('gclient_json', line)
- s.step_log_end('gclient_json')
-
- build_checkout = gclient_json['solutions'].get('build/')
- if build_checkout:
- s.step_text('%(scm)s - %(revision)s' % build_checkout)
- s.set_build_property('build_scm', json.dumps(build_checkout['scm']))
- s.set_build_property('build_revision',
- json.dumps(build_checkout['revision']))
- except Exception as e:
- s.step_text('Unable to process gclient JSON %s' % repr(e))
- s.step_exception()
- finally:
- try:
- os.remove(output_json)
- except Exception as e:
- LOGGER.warning("LEAKED: %s", output_json, exc_info=True)
- else:
- s.step_text('Unable to get SCM data')
- s.step_exception()
-
- os.environ['RUN_SLAVE_UPDATED_SCRIPTS'] = '1'
-
- # After running update scripts, set PYTHONIOENCODING=UTF-8 for the real
- # annotated_run.
- os.environ['PYTHONIOENCODING'] = 'UTF-8'
-
- return True
-
-
def clean_old_recipe_engine():
"""Clean stale pycs from the old location of recipe_engine.
@@ -977,7 +909,7 @@ def main(argv):
def shell_main(argv):
- if update_scripts():
+ if update_scripts.update_scripts():
# Re-execute with the updated annotated_run.py.
rv, _ = _run_command([sys.executable] + argv)
return rv

Powered by Google App Engine
This is Rietveld 408576698