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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 parser = optparse.OptionParser(usage=usage) | 388 parser = optparse.OptionParser(usage=usage) |
389 parser.add_option('-r', '--buildroot', | 389 parser.add_option('-r', '--buildroot', |
390 help='root directory where build occurs', default=".") | 390 help='root directory where build occurs', default=".") |
391 parser.add_option('-n', '--buildnumber', | 391 parser.add_option('-n', '--buildnumber', |
392 help='build number', type='int', default=0) | 392 help='build number', type='int', default=0) |
393 parser.add_option('-f', '--revisionfile', | 393 parser.add_option('-f', '--revisionfile', |
394 help='file where new revisions are stored') | 394 help='file where new revisions are stored') |
395 parser.add_option('--clobber', action='store_true', dest='clobber', | 395 parser.add_option('--clobber', action='store_true', dest='clobber', |
396 default=False, | 396 default=False, |
397 help='Clobbers an old checkout before syncing') | 397 help='Clobbers an old checkout before syncing') |
| 398 parser.add_option('--debug', action='store_true', dest='debug', |
| 399 default=False, |
| 400 help='Override some options to run as a developer.') |
398 (options, args) = parser.parse_args() | 401 (options, args) = parser.parse_args() |
399 | 402 |
400 buildroot = options.buildroot | 403 buildroot = options.buildroot |
401 revisionfile = options.revisionfile | 404 revisionfile = options.revisionfile |
402 | 405 |
403 # Passed option to clobber. | 406 # Passed option to clobber. |
404 if options.clobber: | 407 if options.clobber: |
405 RunCommand(['sudo', 'rm', '-rf', buildroot]) | 408 RunCommand(['sudo', 'rm', '-rf', buildroot]) |
406 | 409 |
407 if len(args) >= 1: | 410 if len(args) >= 1: |
(...skipping 26 matching lines...) Expand all Loading... |
434 if buildconfig['unittests']: | 437 if buildconfig['unittests']: |
435 _RunUnitTests(buildroot) | 438 _RunUnitTests(buildroot) |
436 | 439 |
437 _BuildImage(buildroot) | 440 _BuildImage(buildroot) |
438 | 441 |
439 if buildconfig['smoke_bvt']: | 442 if buildconfig['smoke_bvt']: |
440 _BuildVMImageForTesting(buildroot) | 443 _BuildVMImageForTesting(buildroot) |
441 _RunSmokeSuite(buildroot) | 444 _RunSmokeSuite(buildroot) |
442 | 445 |
443 if buildconfig['uprev']: | 446 if buildconfig['uprev']: |
444 if buildconfig['master']: | 447 # Don't push changes for developers. |
445 # Master bot needs to check if the other slaves completed. | 448 if options.debug: |
446 if cbuildbot_comm.HaveSlavesCompleted(config): | 449 if buildconfig['master']: |
447 _UprevPush(buildroot) | 450 # Master bot needs to check if the other slaves completed. |
448 _UprevCleanup(buildroot) | 451 if cbuildbot_comm.HaveSlavesCompleted(config): |
| 452 _UprevPush(buildroot) |
| 453 else: |
| 454 # At least one of the slaves failed or we timed out. |
| 455 _UprevCleanup(buildroot) |
| 456 Die('CBUILDBOT - One of the slaves has failed!!!') |
| 457 |
449 else: | 458 else: |
450 # At least one of the slaves failed or we timed out. | 459 # Publish my status to the master if its expecting it. |
451 _UprevCleanup(buildroot) | 460 if buildconfig['important']: |
452 Die('CBUILDBOT - One of the slaves has failed!!!') | 461 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) |
453 else: | |
454 # Publish my status to the master if its expecting it. | |
455 if buildconfig['important']: | |
456 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) | |
457 | 462 |
458 _UprevCleanup(buildroot) | 463 _UprevCleanup(buildroot) |
459 except: | 464 except: |
460 # Send failure to master bot. | 465 # Send failure to master bot. |
461 if not buildconfig['master'] and buildconfig['important']: | 466 if not buildconfig['master'] and buildconfig['important']: |
462 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 467 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
463 | 468 |
464 raise | 469 raise |
465 | 470 |
466 | 471 |
467 if __name__ == '__main__': | 472 if __name__ == '__main__': |
468 main() | 473 main() |
OLD | NEW |