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

Side by Side Diff: bin/cbuildbot.py

Issue 3760012: Clean up any previous kvm state. (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: ws Created 10 years, 2 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 | 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 re 10 import re
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES): 227 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES):
228 """Performs a full checkout and clobbers any previous checkouts.""" 228 """Performs a full checkout and clobbers any previous checkouts."""
229 RunCommand(['sudo', 'rm', '-rf', buildroot]) 229 RunCommand(['sudo', 'rm', '-rf', buildroot])
230 MakeDir(buildroot, parents=True) 230 MakeDir(buildroot, parents=True)
231 RunCommand(['repo', 'init', '-u', 'http://git.chromium.org/git/manifest'], 231 RunCommand(['repo', 'init', '-u', 'http://git.chromium.org/git/manifest'],
232 cwd=buildroot, input='\n\ny\n') 232 cwd=buildroot, input='\n\ny\n')
233 RepoSync(buildroot, rw_checkout, retries) 233 RepoSync(buildroot, rw_checkout, retries)
234 234
235 235
236 def _PreFlightRinse(buildroot):
237 """Cleans up any leftover state from previous runs."""
238 RunCommand(['sudo', 'killall', 'kvm'], error_ok=True)
239 _UprevCleanup(buildroot, error_ok=True)
240
241
236 def _IncrementalCheckout(buildroot, rw_checkout=True, 242 def _IncrementalCheckout(buildroot, rw_checkout=True,
237 retries=_DEFAULT_RETRIES): 243 retries=_DEFAULT_RETRIES):
238 """Performs a checkout without clobbering previous checkout.""" 244 """Performs a checkout without clobbering previous checkout."""
239 _UprevCleanup(buildroot, error_ok=True)
240 RepoSync(buildroot, rw_checkout, retries) 245 RepoSync(buildroot, rw_checkout, retries)
241 246
242 247
243 def _MakeChroot(buildroot): 248 def _MakeChroot(buildroot):
244 """Wrapper around make_chroot.""" 249 """Wrapper around make_chroot."""
245 cwd = os.path.join(buildroot, 'src', 'scripts') 250 cwd = os.path.join(buildroot, 'src', 'scripts')
246 RunCommand(['./make_chroot', '--fast'], cwd=cwd) 251 RunCommand(['./make_chroot', '--fast'], cwd=cwd)
247 252
248 253
249 def _SetupBoard(buildroot, board='x86-generic'): 254 def _SetupBoard(buildroot, board='x86-generic'):
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 buildconfig = _GetConfig(args[-1]) 408 buildconfig = _GetConfig(args[-1])
404 else: 409 else:
405 Warning('Missing configuration description') 410 Warning('Missing configuration description')
406 parser.print_usage() 411 parser.print_usage()
407 sys.exit(1) 412 sys.exit(1)
408 413
409 try: 414 try:
410 if not os.path.isdir(buildroot): 415 if not os.path.isdir(buildroot):
411 _FullCheckout(buildroot) 416 _FullCheckout(buildroot)
412 else: 417 else:
418 _PreFlightRinse(buildroot)
413 _IncrementalCheckout(buildroot) 419 _IncrementalCheckout(buildroot)
414 420
415 chroot_path = os.path.join(buildroot, 'chroot') 421 chroot_path = os.path.join(buildroot, 'chroot')
416 if not os.path.isdir(chroot_path): 422 if not os.path.isdir(chroot_path):
417 _MakeChroot(buildroot) 423 _MakeChroot(buildroot)
418 424
419 boardpath = os.path.join(chroot_path, 'build', buildconfig['board']) 425 boardpath = os.path.join(chroot_path, 'build', buildconfig['board'])
420 if not os.path.isdir(boardpath): 426 if not os.path.isdir(boardpath):
421 _SetupBoard(buildroot, board=buildconfig['board']) 427 _SetupBoard(buildroot, board=buildconfig['board'])
422 428
(...skipping 30 matching lines...) Expand all
453 except: 459 except:
454 # Send failure to master bot. 460 # Send failure to master bot.
455 if not buildconfig['master'] and buildconfig['important']: 461 if not buildconfig['master'] and buildconfig['important']:
456 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) 462 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED)
457 463
458 raise 464 raise
459 465
460 466
461 if __name__ == '__main__': 467 if __name__ == '__main__':
462 main() 468 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