| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """A tool to build chrome, executed by buildbot. | 6 """A tool to build chrome, executed by buildbot. |
| 7 | 7 |
| 8 When this is run, the current directory (cwd) should be the outer build | 8 When this is run, the current directory (cwd) should be the outer build |
| 9 directory (e.g., chrome-release/build/). | 9 directory (e.g., chrome-release/build/). |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 options (Option) : options to specify where to store goma-related info. | 80 options (Option) : options to specify where to store goma-related info. |
| 81 env (dict) : used when goma_ctl command executes. | 81 env (dict) : used when goma_ctl command executes. |
| 82 exit_status (int): exit_status sent to monitoring system. | 82 exit_status (int): exit_status sent to monitoring system. |
| 83 """ | 83 """ |
| 84 goma_ctl_cmd = [sys.executable, | 84 goma_ctl_cmd = [sys.executable, |
| 85 os.path.join(options.goma_dir, 'goma_ctl.py')] | 85 os.path.join(options.goma_dir, 'goma_ctl.py')] |
| 86 | 86 |
| 87 if options.goma_jsonstatus: | 87 if options.goma_jsonstatus: |
| 88 chromium_utils.RunCommand( | 88 chromium_utils.RunCommand( |
| 89 goma_ctl_cmd + ['jsonstatus', options.goma_jsonstatus], env=env) | 89 goma_ctl_cmd + ['jsonstatus', options.goma_jsonstatus], env=env) |
| 90 goma_utils.SendGomaTsMon(options.goma_jsonstatus, exit_status, | 90 goma_utils.SendGomaTsMon(options.goma_jsonstatus, exit_status) |
| 91 builder=options.buildbot_buildername, | |
| 92 master=options.buildbot_mastername, | |
| 93 slave=options.buildbot_slavename, | |
| 94 clobber=options.buildbot_clobber) | |
| 95 | 91 |
| 96 # If goma compiler_proxy crashes, there could be crash dump. | 92 # If goma compiler_proxy crashes, there could be crash dump. |
| 97 if options.build_data_dir: | 93 if options.build_data_dir: |
| 98 env['GOMACTL_CRASH_REPORT_ID_FILE'] = os.path.join(options.build_data_dir, | 94 env['GOMACTL_CRASH_REPORT_ID_FILE'] = os.path.join(options.build_data_dir, |
| 99 'crash_report_id_file') | 95 'crash_report_id_file') |
| 100 # We must stop the proxy to dump GomaStats. | 96 # We must stop the proxy to dump GomaStats. |
| 101 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env) | 97 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env) |
| 102 override_gsutil = None | 98 override_gsutil = None |
| 103 if options.gsutil_py_path: | 99 if options.gsutil_py_path: |
| 104 override_gsutil = [sys.executable, options.gsutil_py_path] | 100 override_gsutil = [sys.executable, options.gsutil_py_path] |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 help='Specify path to gsutil.py script.') | 499 help='Specify path to gsutil.py script.') |
| 504 option_parser.add_option('--ninja-path', default='ninja', | 500 option_parser.add_option('--ninja-path', default='ninja', |
| 505 help='Specify path to the ninja tool.') | 501 help='Specify path to the ninja tool.') |
| 506 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true', | 502 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true', |
| 507 help='Checks the output of the ninja builder to ' | 503 help='Checks the output of the ninja builder to ' |
| 508 'confirm that a second compile immediately ' | 504 'confirm that a second compile immediately ' |
| 509 'the first is a no-op.') | 505 'the first is a no-op.') |
| 510 option_parser.add_option('--cloudtail-pid-file', default=None, | 506 option_parser.add_option('--cloudtail-pid-file', default=None, |
| 511 help='Specify a file to store pid of cloudtail') | 507 help='Specify a file to store pid of cloudtail') |
| 512 | 508 |
| 513 # Arguments to pass buildbot properties. | |
| 514 option_parser.add_argument('--buildbot-buildername', default='unknown', | |
| 515 help='buildbot buildername') | |
| 516 option_parser.add_argument('--buildbot-mastername', default='unknown', | |
| 517 help='buildbot mastername') | |
| 518 option_parser.add_argument('--buildbot-slavename', default='unknown', | |
| 519 help='buildbot slavename') | |
| 520 option_parser.add_argument('--buildbot-clobber', help='buildbot clobber') | |
| 521 | |
| 522 options, args = option_parser.parse_args() | 509 options, args = option_parser.parse_args() |
| 523 | 510 |
| 524 if not options.src_dir: | 511 if not options.src_dir: |
| 525 options.src_dir = 'src' | 512 options.src_dir = 'src' |
| 526 options.src_dir = os.path.abspath(options.src_dir) | 513 options.src_dir = os.path.abspath(options.src_dir) |
| 527 | 514 |
| 528 options.target_output_dir = get_target_build_dir(options) | 515 options.target_output_dir = get_target_build_dir(options) |
| 529 | 516 |
| 530 assert options.build_tool in (None, 'ninja') | 517 assert options.build_tool in (None, 'ninja') |
| 531 return options, args | 518 return options, args |
| (...skipping 18 matching lines...) Expand all Loading... |
| 550 exit_status = main_ninja(options, args, env) | 537 exit_status = main_ninja(options, args, env) |
| 551 | 538 |
| 552 # stop goma | 539 # stop goma |
| 553 goma_teardown(options, env, exit_status, goma_cloudtail) | 540 goma_teardown(options, env, exit_status, goma_cloudtail) |
| 554 | 541 |
| 555 return exit_status | 542 return exit_status |
| 556 | 543 |
| 557 | 544 |
| 558 if '__main__' == __name__: | 545 if '__main__' == __name__: |
| 559 sys.exit(real_main()) | 546 sys.exit(real_main()) |
| OLD | NEW |