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

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

Issue 2306523002: Avoid to use environment. (Closed)
Patch Set: rebase Created 4 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 | « no previous file | scripts/slave/goma_utils.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) 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
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)
91 95
92 # If goma compiler_proxy crashes, there could be crash dump. 96 # If goma compiler_proxy crashes, there could be crash dump.
93 if options.build_data_dir: 97 if options.build_data_dir:
94 env['GOMACTL_CRASH_REPORT_ID_FILE'] = os.path.join(options.build_data_dir, 98 env['GOMACTL_CRASH_REPORT_ID_FILE'] = os.path.join(options.build_data_dir,
95 'crash_report_id_file') 99 'crash_report_id_file')
96 # We must stop the proxy to dump GomaStats. 100 # We must stop the proxy to dump GomaStats.
97 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env) 101 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env)
98 override_gsutil = None 102 override_gsutil = None
99 if options.gsutil_py_path: 103 if options.gsutil_py_path:
100 override_gsutil = [sys.executable, options.gsutil_py_path] 104 override_gsutil = [sys.executable, options.gsutil_py_path]
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 help='Specify path to gsutil.py script.') 503 help='Specify path to gsutil.py script.')
500 option_parser.add_option('--ninja-path', default='ninja', 504 option_parser.add_option('--ninja-path', default='ninja',
501 help='Specify path to the ninja tool.') 505 help='Specify path to the ninja tool.')
502 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true', 506 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true',
503 help='Checks the output of the ninja builder to ' 507 help='Checks the output of the ninja builder to '
504 'confirm that a second compile immediately ' 508 'confirm that a second compile immediately '
505 'the first is a no-op.') 509 'the first is a no-op.')
506 option_parser.add_option('--cloudtail-pid-file', default=None, 510 option_parser.add_option('--cloudtail-pid-file', default=None,
507 help='Specify a file to store pid of cloudtail') 511 help='Specify a file to store pid of cloudtail')
508 512
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
509 options, args = option_parser.parse_args() 522 options, args = option_parser.parse_args()
510 523
511 if not options.src_dir: 524 if not options.src_dir:
512 options.src_dir = 'src' 525 options.src_dir = 'src'
513 options.src_dir = os.path.abspath(options.src_dir) 526 options.src_dir = os.path.abspath(options.src_dir)
514 527
515 options.target_output_dir = get_target_build_dir(options) 528 options.target_output_dir = get_target_build_dir(options)
516 529
517 assert options.build_tool in (None, 'ninja') 530 assert options.build_tool in (None, 'ninja')
518 return options, args 531 return options, args
(...skipping 18 matching lines...) Expand all
537 exit_status = main_ninja(options, args, env) 550 exit_status = main_ninja(options, args, env)
538 551
539 # stop goma 552 # stop goma
540 goma_teardown(options, env, exit_status, goma_cloudtail) 553 goma_teardown(options, env, exit_status, goma_cloudtail)
541 554
542 return exit_status 555 return exit_status
543 556
544 557
545 if '__main__' == __name__: 558 if '__main__' == __name__:
546 sys.exit(real_main()) 559 sys.exit(real_main())
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/goma_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698