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

Side by Side Diff: buildbot/buildbot_pnacl_toolchain.py

Issue 2234903002: Check for the existence of goma before trying to use it (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Check in buildbot_pnacl_toolchain.py instead Created 4 years, 4 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 | 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'
32 GOMA_CTL = os.path.join(GOMA_PATH, 'goma_ctl.py')
33
31 # As this is a buildbot script, we want verbose logging. Note however, that 34 # As this is a buildbot script, we want verbose logging. Note however, that
32 # toolchain_build has its own log settings, controlled by its CLI flags. 35 # toolchain_build has its own log settings, controlled by its CLI flags.
33 logging.getLogger().setLevel(logging.DEBUG) 36 logging.getLogger().setLevel(logging.DEBUG)
34 37
35 parser = argparse.ArgumentParser(description='PNaCl toolchain buildbot script') 38 parser = argparse.ArgumentParser(description='PNaCl toolchain buildbot script')
36 group = parser.add_mutually_exclusive_group() 39 group = parser.add_mutually_exclusive_group()
37 group.add_argument('--buildbot', action='store_true', 40 group.add_argument('--buildbot', action='store_true',
38 help='Buildbot mode (build and archive the toolchain)') 41 help='Buildbot mode (build and archive the toolchain)')
39 group.add_argument('--trybot', action='store_true', 42 group.add_argument('--trybot', action='store_true',
40 help='Trybot mode (build but do not archove the toolchain)') 43 help='Trybot mode (build but do not archove the toolchain)')
(...skipping 24 matching lines...) Expand all
65 buildbot_lib.SetDefaultContextAttributes(context) 68 buildbot_lib.SetDefaultContextAttributes(context)
66 context['pnacl'] = True 69 context['pnacl'] = True
67 status = buildbot_lib.BuildStatus(context) 70 status = buildbot_lib.BuildStatus(context)
68 71
69 toolchain_install_dir = os.path.join( 72 toolchain_install_dir = os.path.join(
70 NACL_DIR, 73 NACL_DIR,
71 'toolchain', 74 'toolchain',
72 '%s_%s' % (host_os, pynacl.platform.GetArch()), 75 '%s_%s' % (host_os, pynacl.platform.GetArch()),
73 'pnacl_newlib') 76 'pnacl_newlib')
74 77
75 use_goma = buildbot_lib.RunningOnBuildbot() and not args.no_goma 78 use_goma = (buildbot_lib.RunningOnBuildbot() and not args.no_goma
79 and os.path.isfile(GOMA_CTL))
76 80
77 81
78 def ToolchainBuildCmd(sync=False, extra_flags=[]): 82 def ToolchainBuildCmd(sync=False, extra_flags=[]):
79 sync_flag = ['--sync'] if sync else [] 83 sync_flag = ['--sync'] if sync else []
80 executable_args = [os.path.join('toolchain_build','toolchain_build_pnacl.py'), 84 executable_args = [os.path.join('toolchain_build','toolchain_build_pnacl.py'),
81 '--verbose', '--clobber', 85 '--verbose', '--clobber',
82 '--packages-file', TEMP_PACKAGES_FILE] 86 '--packages-file', TEMP_PACKAGES_FILE]
83 87
84 if pynacl.platform.IsLinux64(): 88 if pynacl.platform.IsLinux64():
85 executable_args.append('--build-sbtc') 89 executable_args.append('--build-sbtc')
(...skipping 10 matching lines...) Expand all
96 executable_args.append('--trybot') 100 executable_args.append('--trybot')
97 101
98 # Enabling LLVM assertions have a higher cost on Windows, particularly in the 102 # Enabling LLVM assertions have a higher cost on Windows, particularly in the
99 # presence of threads. So disable them on windows but leave them on elsewhere 103 # presence of threads. So disable them on windows but leave them on elsewhere
100 # to get the extra error checking. 104 # to get the extra error checking.
101 # See https://code.google.com/p/nativeclient/issues/detail?id=3830 105 # See https://code.google.com/p/nativeclient/issues/detail?id=3830
102 if host_os == 'win': 106 if host_os == 'win':
103 executable_args.append('--disable-llvm-assertions') 107 executable_args.append('--disable-llvm-assertions')
104 108
105 if use_goma: 109 if use_goma:
106 executable_args.append('--goma=/b/build/goma') 110 executable_args.append('--goma=' + GOMA_PATH)
107 111
108 return [sys.executable] + executable_args + sync_flag + extra_flags 112 return [sys.executable] + executable_args + sync_flag + extra_flags
109 113
110 114
111 def RunWithLog(cmd): 115 def RunWithLog(cmd):
112 logging.info('Running: ' + ' '.join(cmd)) 116 logging.info('Running: ' + ' '.join(cmd))
113 subprocess.check_call(cmd) 117 subprocess.check_call(cmd)
114 sys.stdout.flush() 118 sys.stdout.flush()
115 119
116 120
(...skipping 14 matching lines...) Expand all
131 135
132 if host_os != 'win': 136 if host_os != 'win':
133 with buildbot_lib.Step('update clang', status): 137 with buildbot_lib.Step('update clang', status):
134 buildbot_lib.Command( 138 buildbot_lib.Command(
135 context, 139 context,
136 [sys.executable, 140 [sys.executable,
137 os.path.join( 141 os.path.join(
138 NACL_DIR, '..', 'tools', 'clang', 'scripts', 'update.py')]) 142 NACL_DIR, '..', 'tools', 'clang', 'scripts', 'update.py')])
139 143
140 if use_goma: 144 if use_goma:
141 buildbot_lib.Command(context, cmd=[ 145 buildbot_lib.Command(context, cmd=[sys.executable, GOMA_CTL, 'restart'])
142 sys.executable, '/b/build/goma/goma_ctl.py', 'restart'])
143 146
144 # toolchain_build outputs its own buildbot annotations, so don't use 147 # toolchain_build outputs its own buildbot annotations, so don't use
145 # buildbot_lib.Step to run it here. 148 # buildbot_lib.Step to run it here.
146 149
147 # The package_version tools don't have a way to distinguish canonical packages 150 # The package_version tools don't have a way to distinguish canonical packages
148 # (i.e. those we want to upload) from non-canonical ones; they only know how to 151 # (i.e. those we want to upload) from non-canonical ones; they only know how to
149 # process all the archives that are present. We can't just leave out the 152 # process all the archives that are present. We can't just leave out the
150 # the non-canonical packages entirely because they are extracted by the 153 # the non-canonical packages entirely because they are extracted by the
151 # package_version tool. 154 # package_version tool.
152 # First build only the packages that will be uploaded, and upload them. 155 # First build only the packages that will be uploaded, and upload them.
153 RunWithLog(ToolchainBuildCmd(sync=True, extra_flags=['--canonical-only'])) 156 RunWithLog(ToolchainBuildCmd(sync=True, extra_flags=['--canonical-only']))
154 157
155 if use_goma: 158 if use_goma:
156 buildbot_lib.Command(context, cmd=[ 159 buildbot_lib.Command(context, cmd=[sys.executable, GOMA_CTL, 'stop'])
157 sys.executable, '/b/build/goma/goma_ctl.py', 'stop'])
158 160
159 if args.skip_tests: 161 if args.skip_tests:
160 sys.exit(0) 162 sys.exit(0)
161 163
162 if args.buildbot or args.trybot: 164 if args.buildbot or args.trybot:
163 # Don't upload packages from the 32-bit linux bot to avoid racing on 165 # Don't upload packages from the 32-bit linux bot to avoid racing on
164 # uploading the same packages as the 64-bit linux bot 166 # uploading the same packages as the 64-bit linux bot
165 if host_os != 'linux' or pynacl.platform.IsArch64Bit(): 167 if host_os != 'linux' or pynacl.platform.IsArch64Bit():
166 packages.UploadPackages(TEMP_PACKAGES_FILE, args.trybot, args.sanitize) 168 packages.UploadPackages(TEMP_PACKAGES_FILE, args.trybot, args.sanitize)
167 169
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 240
239 if args.buildbot: 241 if args.buildbot:
240 trybot_mode = 'false' 242 trybot_mode = 'false'
241 else: 243 else:
242 trybot_mode = 'true' 244 trybot_mode = 'true'
243 245
244 platform_arg = 'mode-buildbot-tc-' + arch + '-linux' 246 platform_arg = 'mode-buildbot-tc-' + arch + '-linux'
245 247
246 command = ['bash', buildbot_shell, platform_arg, trybot_mode] 248 command = ['bash', buildbot_shell, platform_arg, trybot_mode]
247 RunWithLog(command) 249 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