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

Side by Side Diff: buildbot/cbuildbot_commands.py

Issue 6840064: Restart codereview issue 6792042 (Closed) Base URL: http://git.chromium.org/git/chromite.git@master
Patch Set: Fix exec failures and other meta command failures to regular command failures. Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | buildbot/cbuildbot_commands_unittest.py » ('j') | lib/cros_build_lib.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Module containing the various individual commands a builder can run.""" 5 """Module containing the various individual commands a builder can run."""
6 6
7 import os 7 import os
8 import re 8 import re
9 import shutil 9 import shutil
10 import sys 10 import sys
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 174
175 def SetupBoard(buildroot, board='x86-generic'): 175 def SetupBoard(buildroot, board='x86-generic'):
176 """Wrapper around setup_board.""" 176 """Wrapper around setup_board."""
177 cwd = os.path.join(buildroot, 'src', 'scripts') 177 cwd = os.path.join(buildroot, 'src', 'scripts')
178 cros_lib.OldRunCommand( 178 cros_lib.OldRunCommand(
179 ['./setup_board', '--fast', '--default', '--board=%s' % board], cwd=cwd, 179 ['./setup_board', '--fast', '--default', '--board=%s' % board], cwd=cwd,
180 enter_chroot=True) 180 enter_chroot=True)
181 181
182 182
183 def Build(buildroot, emptytree, build_autotest=True, usepkg=True): 183 def Build(buildroot, emptytree, build_autotest=True, usepkg=True,
184 extra_env={}):
184 """Wrapper around build_packages.""" 185 """Wrapper around build_packages."""
185 cwd = os.path.join(buildroot, 'src', 'scripts') 186 cwd = os.path.join(buildroot, 'src', 'scripts')
186 cmd = ['./build_packages'] 187 cmd = ['./build_packages']
188 env = extra_env.copy()
187 if not build_autotest: cmd.append('--nowithautotest') 189 if not build_autotest: cmd.append('--nowithautotest')
188 if not usepkg: cmd.append('--nousepkg') 190 if not usepkg: cmd.append('--nousepkg')
189 if emptytree: 191 if emptytree:
190 cmd = ['sh', '-c', 'EXTRA_BOARD_FLAGS=--emptytree %s' % ' '.join(cmd)] 192 key = 'EXTRA_BOARD_FLAGS'
191 193 prev = env.get(key)
192 cros_lib.OldRunCommand(cmd, cwd=cwd, enter_chroot=True) 194 env[key] = (prev and prev + ' ' or '') + '--emptytree'
195 cros_lib.RunCommand(cmd, cwd=cwd, enter_chroot=True, extra_env=env)
193 196
194 197
195 def BuildImage(buildroot): 198 def BuildImage(buildroot, extra_env=None):
196 _WipeOldOutput(buildroot) 199 _WipeOldOutput(buildroot)
197 200
198 cwd = os.path.join(buildroot, 'src', 'scripts') 201 cwd = os.path.join(buildroot, 'src', 'scripts')
199 cros_lib.OldRunCommand(['./build_image', '--replace'], cwd=cwd, 202 cros_lib.RunCommand(['./build_image', '--replace'], cwd=cwd,
200 enter_chroot=True) 203 enter_chroot=True, extra_env=extra_env)
201 204
202 205
203 def BuildVMImageForTesting(buildroot): 206 def BuildVMImageForTesting(buildroot, extra_env=None):
204 (vdisk_size, statefulfs_size) = _GetVMConstants(buildroot) 207 (vdisk_size, statefulfs_size) = _GetVMConstants(buildroot)
205 cwd = os.path.join(buildroot, 'src', 'scripts') 208 cwd = os.path.join(buildroot, 'src', 'scripts')
206 cros_lib.OldRunCommand(['./image_to_vm.sh', 209 cros_lib.RunCommand(['./image_to_vm.sh',
207 '--test_image', 210 '--test_image',
208 '--full', 211 '--full',
209 '--vdisk_size=%s' % vdisk_size, 212 '--vdisk_size=%s' % vdisk_size,
210 '--statefulfs_size=%s' % statefulfs_size, 213 '--statefulfs_size=%s' % statefulfs_size,
211 ], cwd=cwd, enter_chroot=True) 214 ], cwd=cwd, enter_chroot=True, extra_env=extra_env)
212 215
213 216
214 def RunUnitTests(buildroot, full): 217 def RunUnitTests(buildroot, full):
215 cwd = os.path.join(buildroot, 'src', 'scripts') 218 cwd = os.path.join(buildroot, 'src', 'scripts')
216 219
217 cmd = ['cros_run_unit_tests'] 220 cmd = ['cros_run_unit_tests']
218 221
219 # If we aren't running ALL tests, then restrict to just the packages 222 # If we aren't running ALL tests, then restrict to just the packages
220 # uprev noticed were changed. 223 # uprev noticed were changed.
221 if not full: 224 if not full:
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 473
471 archive_url = None 474 archive_url = None
472 key_re = re.compile('^%s=(.*)$' % _CROS_ARCHIVE_URL) 475 key_re = re.compile('^%s=(.*)$' % _CROS_ARCHIVE_URL)
473 for line in result.output.splitlines(): 476 for line in result.output.splitlines():
474 line_match = key_re.match(line) 477 line_match = key_re.match(line)
475 if line_match: 478 if line_match:
476 archive_url = line_match.group(1) 479 archive_url = line_match.group(1)
477 480
478 assert archive_url, 'Archive Build Failed to Provide Archive URL' 481 assert archive_url, 'Archive Build Failed to Provide Archive URL'
479 return archive_url 482 return archive_url
OLDNEW
« no previous file with comments | « no previous file | buildbot/cbuildbot_commands_unittest.py » ('j') | lib/cros_build_lib.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698