Chromium Code Reviews| 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 heapq | 10 import heapq |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 paths = [private_overlay] | 480 paths = [private_overlay] |
| 481 elif overlays == 'public': | 481 elif overlays == 'public': |
| 482 paths = [public_overlay] | 482 paths = [public_overlay] |
| 483 elif overlays == 'both': | 483 elif overlays == 'both': |
| 484 paths = [public_overlay, private_overlay] | 484 paths = [public_overlay, private_overlay] |
| 485 else: | 485 else: |
| 486 Die('Incorrect overlay configuration: %s' % overlays) | 486 Die('Incorrect overlay configuration: %s' % overlays) |
| 487 return paths | 487 return paths |
| 488 | 488 |
| 489 | 489 |
| 490 def _UploadPrebuilts(buildroot, board, overlay_config, master): | |
|
sosa
2010/11/16 23:48:06
Missing short docstring
davidjames
2010/11/17 00:15:43
Done.
| |
| 491 cmd = ['%s/src/scripts/prebuilt.py' % buildroot, '--git-sync', | |
| 492 '-p', buildroot, '-b', board, '-V', 'preflight', | |
|
sosa
2010/11/16 23:48:06
Please use long options
davidjames
2010/11/17 00:15:43
Done.
| |
| 493 '-k', 'PREFLIGHT_BINHOST'] | |
| 494 if overlay_config == 'public': | |
| 495 cmd.extend(['-u', 'gs://chromeos-prebuilt']) | |
| 496 else: | |
| 497 assert overlay_config in ('private', 'both') | |
| 498 cmd.extend(['-u', 'chromeos-images:/var/www/prebuilt/', | |
|
sosa
2010/11/16 23:48:06
any reason we are not taking these as options and
davidjames
2010/11/17 00:15:43
Just discussed this over chat. We're trying to kee
| |
| 499 '-H', 'http://chromeos-prebuilt']) | |
| 500 | |
| 501 if master: | |
| 502 cmd.append('--sync-host') | |
| 503 | |
| 504 RunCommand(cmd) | |
| 505 | |
| 506 | |
| 490 def main(): | 507 def main(): |
| 491 # Parse options | 508 # Parse options |
| 492 usage = "usage: %prog [options] cbuildbot_config" | 509 usage = "usage: %prog [options] cbuildbot_config" |
| 493 parser = optparse.OptionParser(usage=usage) | 510 parser = optparse.OptionParser(usage=usage) |
| 494 parser.add_option('-r', '--buildroot', | 511 parser.add_option('-r', '--buildroot', |
| 495 help='root directory where build occurs', default=".") | 512 help='root directory where build occurs', default=".") |
| 496 parser.add_option('-n', '--buildnumber', | 513 parser.add_option('-n', '--buildnumber', |
| 497 help='build number', type='int', default=0) | 514 help='build number', type='int', default=0) |
| 498 parser.add_option('-f', '--revisionfile', | 515 parser.add_option('-f', '--revisionfile', |
| 499 help='file where new revisions are stored') | 516 help='file where new revisions are stored') |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 if buildconfig['smoke_bvt']: | 577 if buildconfig['smoke_bvt']: |
| 561 _BuildVMImageForTesting(buildroot) | 578 _BuildVMImageForTesting(buildroot) |
| 562 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber | 579 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber |
| 563 try: | 580 try: |
| 564 _RunSmokeSuite(buildroot, test_results_dir) | 581 _RunSmokeSuite(buildroot, test_results_dir) |
| 565 finally: | 582 finally: |
| 566 _ArchiveTestResults(buildroot, buildconfig['board'], | 583 _ArchiveTestResults(buildroot, buildconfig['board'], |
| 567 archive_dir=options.buildnumber, | 584 archive_dir=options.buildnumber, |
| 568 test_results_dir=test_results_dir) | 585 test_results_dir=test_results_dir) |
| 569 | 586 |
| 587 if not options.debug: | |
| 588 _UploadPrebuilts(buildroot, buildconfig['board'], buildconfig['overlays'], | |
| 589 buildconfig['master']) | |
|
sosa
2010/11/16 23:48:06
Better to do this after the uprev i.e. if we can't
davidjames
2010/11/17 00:15:43
Done.
| |
| 590 | |
| 570 if buildconfig['uprev']: | 591 if buildconfig['uprev']: |
| 571 # Don't push changes for developers. | 592 # Don't push changes for developers. |
| 572 if not options.debug: | 593 if not options.debug: |
| 573 if buildconfig['master']: | 594 if buildconfig['master']: |
| 574 # Master bot needs to check if the other slaves completed. | 595 # Master bot needs to check if the other slaves completed. |
| 575 if cbuildbot_comm.HaveSlavesCompleted(config): | 596 if cbuildbot_comm.HaveSlavesCompleted(config): |
| 576 _UprevPush(buildroot, tracking_branch, buildconfig['board'], | 597 _UprevPush(buildroot, tracking_branch, buildconfig['board'], |
| 577 overlays) | 598 overlays) |
| 578 else: | 599 else: |
| 579 Die('CBUILDBOT - One of the slaves has failed!!!') | 600 Die('CBUILDBOT - One of the slaves has failed!!!') |
| 580 | 601 |
| 581 else: | 602 else: |
| 582 # Publish my status to the master if its expecting it. | 603 # Publish my status to the master if its expecting it. |
| 583 if buildconfig['important']: | 604 if buildconfig['important']: |
| 584 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) | 605 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) |
| 585 | 606 |
| 586 except: | 607 except: |
| 587 # Send failure to master bot. | 608 # Send failure to master bot. |
| 588 if not buildconfig['master'] and buildconfig['important']: | 609 if not buildconfig['master'] and buildconfig['important']: |
| 589 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 610 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
| 590 | 611 |
| 591 raise | 612 raise |
| 592 | 613 |
| 593 | 614 |
| 594 if __name__ == '__main__': | 615 if __name__ == '__main__': |
| 595 main() | 616 main() |
| OLD | NEW |