Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import collections | 7 import collections |
| 8 import copy | 8 import copy |
| 9 import json | 9 import json |
| 10 import os | 10 import os |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 proc = subprocess.Popen(['bash', '-exc', | 63 proc = subprocess.Popen(['bash', '-exc', |
| 64 envsetup_cmd + ' >&2; python build/android/buildbot/env_to_json.py'], | 64 envsetup_cmd + ' >&2; python build/android/buildbot/env_to_json.py'], |
| 65 stdout=subprocess.PIPE, stderr=subprocess.PIPE, | 65 stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
| 66 cwd=bb_utils.CHROME_SRC, env=init_env) | 66 cwd=bb_utils.CHROME_SRC, env=init_env) |
| 67 json_env, envsetup_output = proc.communicate() | 67 json_env, envsetup_output = proc.communicate() |
| 68 if proc.returncode != 0: | 68 if proc.returncode != 0: |
| 69 print >> sys.stderr, 'FATAL Failure in envsetup.' | 69 print >> sys.stderr, 'FATAL Failure in envsetup.' |
| 70 print >> sys.stderr, envsetup_output | 70 print >> sys.stderr, envsetup_output |
| 71 sys.exit(1) | 71 sys.exit(1) |
| 72 env = json.loads(json_env) | 72 env = json.loads(json_env) |
| 73 | |
| 74 # PWD is wrong due to the cwd= parameter passed to subprocess.Popen(). Make | |
| 75 # sure the modified PWD doesn't leak into future build steps. | |
| 76 env['PWD'] = init_env['PWD'] | |
| 77 | |
| 73 env['GYP_DEFINES'] = env.get('GYP_DEFINES', '') + ' fastbuild=1' | 78 env['GYP_DEFINES'] = env.get('GYP_DEFINES', '') + ' fastbuild=1' |
| 74 extra_gyp = host_obj.extra_gyp_defines | 79 extra_gyp = host_obj.extra_gyp_defines |
| 75 if extra_gyp: | 80 if extra_gyp: |
| 76 env['GYP_DEFINES'] += ' %s' % extra_gyp | 81 env['GYP_DEFINES'] += ' %s' % extra_gyp |
| 77 if re.search('(asan|clang)=1', extra_gyp): | 82 if re.search('(asan|clang)=1', extra_gyp): |
| 78 env.pop('CXX_target', None) | 83 env.pop('CXX_target', None) |
| 79 | 84 |
| 80 # Bots checkout chrome in /b/build/slave/<name>/build/src | 85 # Bots checkout chrome in /b/build/slave/<name>/build/src |
| 81 build_internal_android = os.path.abspath(os.path.join( | 86 build_internal_android = os.path.abspath(os.path.join( |
| 82 bb_utils.CHROME_SRC, '..', '..', '..', '..', '..', 'build_internal', | 87 bb_utils.CHROME_SRC, '..', '..', '..', '..', '..', 'build_internal', |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 | 259 |
| 255 def RunBotCommands(options, commands, env): | 260 def RunBotCommands(options, commands, env): |
| 256 print 'Environment changes:' | 261 print 'Environment changes:' |
| 257 print DictDiff(dict(os.environ), env) | 262 print DictDiff(dict(os.environ), env) |
| 258 | 263 |
| 259 for command in commands: | 264 for command in commands: |
| 260 print bb_utils.CommandToString(command) | 265 print bb_utils.CommandToString(command) |
| 261 sys.stdout.flush() | 266 sys.stdout.flush() |
| 262 if options.testing: | 267 if options.testing: |
| 263 env['BUILDBOT_TESTING'] = '1' | 268 env['BUILDBOT_TESTING'] = '1' |
| 264 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) | 269 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) |
|
Isaac (away)
2013/10/21 20:08:32
We use env here and the cwd is CHROME_SRC.
Nico
2013/10/21 20:12:10
Since this sets an explicit cwd it'll clobber what
| |
| 265 if return_code != 0: | 270 if return_code != 0: |
| 266 return return_code | 271 return return_code |
| 267 | 272 |
| 268 | 273 |
| 269 def main(argv): | 274 def main(argv): |
| 270 parser = GetRunBotOptParser() | 275 parser = GetRunBotOptParser() |
| 271 options, args = parser.parse_args(argv[1:]) | 276 options, args = parser.parse_args(argv[1:]) |
| 272 if args: | 277 if args: |
| 273 parser.error('Unused args: %s' % args) | 278 parser.error('Unused args: %s' % args) |
| 274 | 279 |
| 275 bot_config = GetBotConfig(options, GetBotStepMap()) | 280 bot_config = GetBotConfig(options, GetBotStepMap()) |
| 276 if not bot_config: | 281 if not bot_config: |
| 277 sys.exit(1) | 282 sys.exit(1) |
| 278 | 283 |
| 279 print 'Using config:', bot_config | 284 print 'Using config:', bot_config |
| 280 | 285 |
| 281 commands = GetCommands(options, bot_config) | 286 commands = GetCommands(options, bot_config) |
| 282 for command in commands: | 287 for command in commands: |
| 283 print 'Will run: ', bb_utils.CommandToString(command) | 288 print 'Will run: ', bb_utils.CommandToString(command) |
| 284 print | 289 print |
| 285 | 290 |
| 286 env = GetEnvironment(bot_config.host_obj, options.testing) | 291 env = GetEnvironment(bot_config.host_obj, options.testing) |
| 287 return RunBotCommands(options, commands, env) | 292 return RunBotCommands(options, commands, env) |
| 288 | 293 |
| 289 | 294 |
| 290 if __name__ == '__main__': | 295 if __name__ == '__main__': |
| 291 sys.exit(main(sys.argv)) | 296 sys.exit(main(sys.argv)) |
| OLD | NEW |