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

Side by Side Diff: buildbot/buildbot_pnacl_toolchain.py

Issue 2486313003: Make GOMA_DIR injected from env. (Closed)
Patch Set: moved NOSTART_GOMA and renamed it. Created 4 years, 1 month 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 | no next file » | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2013 The Native Client 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 argparse 6 import argparse
7 import logging 7 import logging
8 import os 8 import os
9 import platform 9 import platform
10 import subprocess 10 import subprocess
(...skipping 10 matching lines...) Expand all
21 NACL_DIR = os.path.dirname(SCRIPT_DIR) 21 NACL_DIR = os.path.dirname(SCRIPT_DIR)
22 TOOLCHAIN_BUILD_DIR = os.path.join(NACL_DIR, 'toolchain_build') 22 TOOLCHAIN_BUILD_DIR = os.path.join(NACL_DIR, 'toolchain_build')
23 TOOLCHAIN_BUILD_OUT_DIR = os.path.join(TOOLCHAIN_BUILD_DIR, 'out') 23 TOOLCHAIN_BUILD_OUT_DIR = os.path.join(TOOLCHAIN_BUILD_DIR, 'out')
24 24
25 TEMP_PACKAGES_FILE = os.path.join(TOOLCHAIN_BUILD_OUT_DIR, 'packages.txt') 25 TEMP_PACKAGES_FILE = os.path.join(TOOLCHAIN_BUILD_OUT_DIR, 'packages.txt')
26 26
27 BUILD_DIR = os.path.join(NACL_DIR, 'build') 27 BUILD_DIR = os.path.join(NACL_DIR, 'build')
28 PACKAGE_VERSION_DIR = os.path.join(BUILD_DIR, 'package_version') 28 PACKAGE_VERSION_DIR = os.path.join(BUILD_DIR, 'package_version')
29 PACKAGE_VERSION_SCRIPT = os.path.join(PACKAGE_VERSION_DIR, 'package_version.py') 29 PACKAGE_VERSION_SCRIPT = os.path.join(PACKAGE_VERSION_DIR, 'package_version.py')
30 30
31 GOMA_PATH = '/b/build/goma' 31 GOMA_DEFAULT_PATH = '/b/build/goma'
32 GOMA_PATH = os.environ.get('GOMA_DIR', GOMA_DEFAULT_PATH)
32 GOMA_CTL = os.path.join(GOMA_PATH, 'goma_ctl.py') 33 GOMA_CTL = os.path.join(GOMA_PATH, 'goma_ctl.py')
33 34
34 # As this is a buildbot script, we want verbose logging. Note however, that 35 # As this is a buildbot script, we want verbose logging. Note however, that
35 # toolchain_build has its own log settings, controlled by its CLI flags. 36 # toolchain_build has its own log settings, controlled by its CLI flags.
36 logging.getLogger().setLevel(logging.DEBUG) 37 logging.getLogger().setLevel(logging.DEBUG)
37 38
38 parser = argparse.ArgumentParser(description='PNaCl toolchain buildbot script') 39 parser = argparse.ArgumentParser(description='PNaCl toolchain buildbot script')
39 group = parser.add_mutually_exclusive_group() 40 group = parser.add_mutually_exclusive_group()
40 group.add_argument('--buildbot', action='store_true', 41 group.add_argument('--buildbot', action='store_true',
41 help='Buildbot mode (build and archive the toolchain)') 42 help='Buildbot mode (build and archive the toolchain)')
(...skipping 29 matching lines...) Expand all
71 72
72 toolchain_install_dir = os.path.join( 73 toolchain_install_dir = os.path.join(
73 NACL_DIR, 74 NACL_DIR,
74 'toolchain', 75 'toolchain',
75 '%s_%s' % (host_os, pynacl.platform.GetArch()), 76 '%s_%s' % (host_os, pynacl.platform.GetArch()),
76 'pnacl_newlib') 77 'pnacl_newlib')
77 78
78 use_goma = (buildbot_lib.RunningOnBuildbot() and not args.no_goma 79 use_goma = (buildbot_lib.RunningOnBuildbot() and not args.no_goma
79 and os.path.isfile(GOMA_CTL)) 80 and os.path.isfile(GOMA_CTL))
80 81
82 # If NOCONTROL_GOMA is set, the script does not start/stop goma compiler_proxy.
83 control_goma = use_goma and not os.environ.get('NOCONTROL_GOMA')
84
81 85
82 def ToolchainBuildCmd(sync=False, extra_flags=[]): 86 def ToolchainBuildCmd(sync=False, extra_flags=[]):
83 sync_flag = ['--sync'] if sync else [] 87 sync_flag = ['--sync'] if sync else []
84 executable_args = [os.path.join('toolchain_build','toolchain_build_pnacl.py'), 88 executable_args = [os.path.join('toolchain_build','toolchain_build_pnacl.py'),
85 '--verbose', '--clobber', 89 '--verbose', '--clobber',
86 '--packages-file', TEMP_PACKAGES_FILE] 90 '--packages-file', TEMP_PACKAGES_FILE]
87 91
88 if pynacl.platform.IsLinux64(): 92 if pynacl.platform.IsLinux64():
89 executable_args.append('--build-sbtc') 93 executable_args.append('--build-sbtc')
90 94
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 138
135 139
136 if host_os != 'win': 140 if host_os != 'win':
137 with buildbot_lib.Step('update clang', status): 141 with buildbot_lib.Step('update clang', status):
138 buildbot_lib.Command( 142 buildbot_lib.Command(
139 context, 143 context,
140 [sys.executable, 144 [sys.executable,
141 os.path.join( 145 os.path.join(
142 NACL_DIR, '..', 'tools', 'clang', 'scripts', 'update.py')]) 146 NACL_DIR, '..', 'tools', 'clang', 'scripts', 'update.py')])
143 147
144 if use_goma: 148 if control_goma:
145 buildbot_lib.Command(context, cmd=[sys.executable, GOMA_CTL, 'restart']) 149 buildbot_lib.Command(context, cmd=[sys.executable, GOMA_CTL, 'restart'])
146 150
147 # toolchain_build outputs its own buildbot annotations, so don't use 151 # toolchain_build outputs its own buildbot annotations, so don't use
148 # buildbot_lib.Step to run it here. 152 # buildbot_lib.Step to run it here.
149 153
150 # The package_version tools don't have a way to distinguish canonical packages 154 # The package_version tools don't have a way to distinguish canonical packages
151 # (i.e. those we want to upload) from non-canonical ones; they only know how to 155 # (i.e. those we want to upload) from non-canonical ones; they only know how to
152 # process all the archives that are present. We can't just leave out the 156 # process all the archives that are present. We can't just leave out the
153 # the non-canonical packages entirely because they are extracted by the 157 # the non-canonical packages entirely because they are extracted by the
154 # package_version tool. 158 # package_version tool.
155 # First build only the packages that will be uploaded, and upload them. 159 # First build only the packages that will be uploaded, and upload them.
156 RunWithLog(ToolchainBuildCmd(sync=True, extra_flags=['--canonical-only'])) 160 RunWithLog(ToolchainBuildCmd(sync=True, extra_flags=['--canonical-only']))
157 161
158 if use_goma: 162 if control_goma:
159 buildbot_lib.Command(context, cmd=[sys.executable, GOMA_CTL, 'stop']) 163 buildbot_lib.Command(context, cmd=[sys.executable, GOMA_CTL, 'stop'])
160 164
161 if args.skip_tests: 165 if args.skip_tests:
162 sys.exit(0) 166 sys.exit(0)
163 167
164 if args.buildbot or args.trybot: 168 if args.buildbot or args.trybot:
165 # Don't upload packages from the 32-bit linux bot to avoid racing on 169 # Don't upload packages from the 32-bit linux bot to avoid racing on
166 # uploading the same packages as the 64-bit linux bot 170 # uploading the same packages as the 64-bit linux bot
167 if host_os != 'linux' or pynacl.platform.IsArch64Bit(): 171 if host_os != 'linux' or pynacl.platform.IsArch64Bit():
168 packages.UploadPackages(TEMP_PACKAGES_FILE, args.trybot, args.sanitize) 172 packages.UploadPackages(TEMP_PACKAGES_FILE, args.trybot, args.sanitize)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 244
241 if args.buildbot: 245 if args.buildbot:
242 trybot_mode = 'false' 246 trybot_mode = 'false'
243 else: 247 else:
244 trybot_mode = 'true' 248 trybot_mode = 'true'
245 249
246 platform_arg = 'mode-buildbot-tc-' + arch + '-linux' 250 platform_arg = 'mode-buildbot-tc-' + arch + '-linux'
247 251
248 command = ['bash', buildbot_shell, platform_arg, trybot_mode] 252 command = ['bash', buildbot_shell, platform_arg, trybot_mode]
249 RunWithLog(command) 253 RunWithLog(command)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698