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

Side by Side Diff: bin/cbuildbot.py

Issue 4104005: Correctly initialize tracking branch in preflight rinse. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: Created 10 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 | Annotate | Revision Log
« 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 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """CBuildbot is wrapper around the build process used by the pre-flight queue""" 7 """CBuildbot is wrapper around the build process used by the pre-flight queue"""
8 8
9 import errno 9 import errno
10 import heapq 10 import heapq
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 source_cmd = 'source %s/cros_vm_constants.sh' % cwd 217 source_cmd = 'source %s/cros_vm_constants.sh' % cwd
218 vdisk_size = RunCommand([ 218 vdisk_size = RunCommand([
219 '/bin/bash', '-c', '%s && echo $MIN_VDISK_SIZE_FULL' % source_cmd], 219 '/bin/bash', '-c', '%s && echo $MIN_VDISK_SIZE_FULL' % source_cmd],
220 redirect_stdout=True) 220 redirect_stdout=True)
221 statefulfs_size = RunCommand([ 221 statefulfs_size = RunCommand([
222 '/bin/bash', '-c', '%s && echo $MIN_STATEFUL_FS_SIZE_FULL' % source_cmd], 222 '/bin/bash', '-c', '%s && echo $MIN_STATEFUL_FS_SIZE_FULL' % source_cmd],
223 redirect_stdout=True) 223 redirect_stdout=True)
224 return (vdisk_size.strip(), statefulfs_size.strip()) 224 return (vdisk_size.strip(), statefulfs_size.strip())
225 225
226 226
227 def _GitCleanup(buildroot, board): 227 def _GitCleanup(buildroot, board, tracking_branch):
228 """Clean up git branch after previous uprev attempt.""" 228 """Clean up git branch after previous uprev attempt."""
229 cwd = os.path.join(buildroot, 'src', 'scripts') 229 cwd = os.path.join(buildroot, 'src', 'scripts')
230 if os.path.exists(cwd): 230 if os.path.exists(cwd):
231 RunCommand(['./cros_mark_as_stable', '--srcroot=..', 231 RunCommand(['./cros_mark_as_stable', '--srcroot=..',
232 '--board=%s' % board, 232 '--board=%s' % board,
233 '--tracking_branch="cros/master"', 'clean'], 233 '--tracking_branch="%s"' % tracking_branch, 'clean'],
234 cwd=cwd, error_ok=True) 234 cwd=cwd, error_ok=True)
235 235
236 236
237 def _CleanUpMountPoints(buildroot): 237 def _CleanUpMountPoints(buildroot):
238 """Cleans up any stale mount points from previous runs.""" 238 """Cleans up any stale mount points from previous runs."""
239 mount_output = RunCommand(['mount'], redirect_stdout=True) 239 mount_output = RunCommand(['mount'], redirect_stdout=True)
240 mount_pts_in_buildroot = RunCommand(['grep', buildroot], input=mount_output, 240 mount_pts_in_buildroot = RunCommand(['grep', buildroot], input=mount_output,
241 redirect_stdout=True, error_ok=True) 241 redirect_stdout=True, error_ok=True)
242 242
243 for mount_pt_str in mount_pts_in_buildroot.splitlines(): 243 for mount_pt_str in mount_pts_in_buildroot.splitlines():
244 mount_pt = mount_pt_str.rpartition(' type ')[0].partition(' on ')[2] 244 mount_pt = mount_pt_str.rpartition(' type ')[0].partition(' on ')[2]
245 RunCommand(['sudo', 'umount', '-l', mount_pt], error_ok=True) 245 RunCommand(['sudo', 'umount', '-l', mount_pt], error_ok=True)
246 246
247 247
248 def _WipeOldOutput(buildroot): 248 def _WipeOldOutput(buildroot):
249 """Wipes out build output directories.""" 249 """Wipes out build output directories."""
250 RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot) 250 RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot)
251 251
252 252
253 # =========================== Main Commands =================================== 253 # =========================== Main Commands ===================================
254 254
255 255
256 def _PreFlightRinse(buildroot, board): 256 def _PreFlightRinse(buildroot, board, tracking_branch):
257 """Cleans up any leftover state from previous runs.""" 257 """Cleans up any leftover state from previous runs."""
258 _GitCleanup(buildroot, board) 258 _GitCleanup(buildroot, board, tracking_branch)
259 _CleanUpMountPoints(buildroot) 259 _CleanUpMountPoints(buildroot)
260 RunCommand(['sudo', 'killall', 'kvm'], error_ok=True) 260 RunCommand(['sudo', 'killall', 'kvm'], error_ok=True)
261 261
262 262
263 def _FullCheckout(buildroot, tracking_branch, rw_checkout=True, 263 def _FullCheckout(buildroot, tracking_branch, rw_checkout=True,
264 retries=_DEFAULT_RETRIES, 264 retries=_DEFAULT_RETRIES,
265 url='http://git.chromium.org/git/manifest'): 265 url='http://git.chromium.org/git/manifest'):
266 """Performs a full checkout and clobbers any previous checkouts.""" 266 """Performs a full checkout and clobbers any previous checkouts."""
267 RunCommand(['sudo', 'rm', '-rf', buildroot]) 267 RunCommand(['sudo', 'rm', '-rf', buildroot])
268 MakeDir(buildroot, parents=True) 268 MakeDir(buildroot, parents=True)
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 tracking_branch = options.tracking_branch 483 tracking_branch = options.tracking_branch
484 484
485 if len(args) >= 1: 485 if len(args) >= 1:
486 buildconfig = _GetConfig(args[-1]) 486 buildconfig = _GetConfig(args[-1])
487 else: 487 else:
488 Warning('Missing configuration description') 488 Warning('Missing configuration description')
489 parser.print_usage() 489 parser.print_usage()
490 sys.exit(1) 490 sys.exit(1)
491 491
492 try: 492 try:
493 _PreFlightRinse(buildroot, buildconfig['board']) 493 _PreFlightRinse(buildroot, buildconfig['board'], tracking_branch)
494 if options.clobber or not os.path.isdir(buildroot): 494 if options.clobber or not os.path.isdir(buildroot):
495 _FullCheckout(buildroot, tracking_branch, url=options.url) 495 _FullCheckout(buildroot, tracking_branch, url=options.url)
496 else: 496 else:
497 _IncrementalCheckout(buildroot) 497 _IncrementalCheckout(buildroot)
498 498
499 chroot_path = os.path.join(buildroot, 'chroot') 499 chroot_path = os.path.join(buildroot, 'chroot')
500 if not os.path.isdir(chroot_path): 500 if not os.path.isdir(chroot_path):
501 _MakeChroot(buildroot) 501 _MakeChroot(buildroot)
502 502
503 boardpath = os.path.join(chroot_path, 'build', buildconfig['board']) 503 boardpath = os.path.join(chroot_path, 'build', buildconfig['board'])
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 except: 543 except:
544 # Send failure to master bot. 544 # Send failure to master bot.
545 if not buildconfig['master'] and buildconfig['important']: 545 if not buildconfig['master'] and buildconfig['important']:
546 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) 546 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED)
547 547
548 raise 548 raise
549 549
550 550
551 if __name__ == '__main__': 551 if __name__ == '__main__':
552 main() 552 main()
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