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