OLD | NEW |
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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 _UprevAllPackages(buildroot) | 338 _UprevAllPackages(buildroot) |
339 | 339 |
340 | 340 |
341 def _UprevCleanup(buildroot, error_ok=False): | 341 def _UprevCleanup(buildroot, error_ok=False): |
342 """Clean up after a previous uprev attempt.""" | 342 """Clean up after a previous uprev attempt.""" |
343 cwd = os.path.join(buildroot, 'src', 'scripts') | 343 cwd = os.path.join(buildroot, 'src', 'scripts') |
344 RunCommand(['./cros_mark_as_stable', '--srcroot=..', | 344 RunCommand(['./cros_mark_as_stable', '--srcroot=..', |
345 '--tracking_branch="cros/master"', 'clean'], | 345 '--tracking_branch="cros/master"', 'clean'], |
346 cwd=cwd, error_ok=error_ok) | 346 cwd=cwd, error_ok=error_ok) |
347 | 347 |
348 workon_packages = RunCommand(['./cros_workon', 'list'], | |
349 enter_chroot=True, cwd=cwd, error_ok=error_ok, | |
350 redirect_stdout=True) | |
351 if workon_packages: | |
352 Info('Cleaning up workon packages %s' % workon_packages) | |
353 RunCommand(['./cros_workon', 'stop'] + workon_packages.split(), | |
354 enter_chroot=True, cwd=cwd, error_ok=False) | |
355 | |
356 | 348 |
357 def _UprevPush(buildroot): | 349 def _UprevPush(buildroot): |
358 """Pushes uprev changes to the main line.""" | 350 """Pushes uprev changes to the main line.""" |
359 cwd = os.path.join(buildroot, 'src', 'scripts') | 351 cwd = os.path.join(buildroot, 'src', 'scripts') |
360 RunCommand(['./cros_mark_as_stable', '--srcroot=..', | 352 RunCommand(['./cros_mark_as_stable', '--srcroot=..', |
361 '--tracking_branch="cros/master"', | 353 '--tracking_branch="cros/master"', |
362 '--push_options', '--bypass-hooks -f', 'push'], | 354 '--push_options', '--bypass-hooks -f', 'push'], |
363 cwd=cwd) | 355 cwd=cwd) |
364 | 356 |
365 | 357 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 432 |
441 if buildconfig['smoke_bvt']: | 433 if buildconfig['smoke_bvt']: |
442 _BuildVMImageForTesting(buildroot) | 434 _BuildVMImageForTesting(buildroot) |
443 _RunSmokeSuite(buildroot) | 435 _RunSmokeSuite(buildroot) |
444 | 436 |
445 if buildconfig['uprev']: | 437 if buildconfig['uprev']: |
446 if buildconfig['master']: | 438 if buildconfig['master']: |
447 # Master bot needs to check if the other slaves completed. | 439 # Master bot needs to check if the other slaves completed. |
448 if cbuildbot_comm.HaveSlavesCompleted(config): | 440 if cbuildbot_comm.HaveSlavesCompleted(config): |
449 _UprevPush(buildroot) | 441 _UprevPush(buildroot) |
| 442 _UprevCleanup(buildroot) |
450 else: | 443 else: |
451 # At least one of the slaves failed or we timed out. | 444 # At least one of the slaves failed or we timed out. |
452 _UprevCleanup(buildroot) | 445 _UprevCleanup(buildroot) |
453 Die('CBUILDBOT - One of the slaves has failed!!!') | 446 Die('CBUILDBOT - One of the slaves has failed!!!') |
454 else: | 447 else: |
455 # Publish my status to the master if its expecting it. | 448 # Publish my status to the master if its expecting it. |
456 if buildconfig['important']: | 449 if buildconfig['important']: |
457 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) | 450 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) |
458 | 451 |
459 _UprevCleanup(buildroot) | 452 _UprevCleanup(buildroot) |
460 except: | 453 except: |
461 # Send failure to master bot. | 454 # Send failure to master bot. |
462 if not buildconfig['master'] and buildconfig['important']: | 455 if not buildconfig['master'] and buildconfig['important']: |
463 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 456 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
464 | 457 |
465 raise | 458 raise |
466 | 459 |
467 | 460 |
468 if __name__ == '__main__': | 461 if __name__ == '__main__': |
469 main() | 462 main() |
OLD | NEW |