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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 cmd = ['./build_packages'] | 409 cmd = ['./build_packages'] |
410 if emptytree: | 410 if emptytree: |
411 cmd.insert(0, 'EXTRA_BOARD_FLAGS=--emptytree') | 411 cmd.insert(0, 'EXTRA_BOARD_FLAGS=--emptytree') |
412 | 412 |
413 RunCommand(cmd, cwd=cwd, enter_chroot=True) | 413 RunCommand(cmd, cwd=cwd, enter_chroot=True) |
414 | 414 |
415 | 415 |
416 def _BuildChrome(buildroot, board, chrome_atom_to_build): | 416 def _BuildChrome(buildroot, board, chrome_atom_to_build): |
417 """Wrapper for emerge call to build Chrome.""" | 417 """Wrapper for emerge call to build Chrome.""" |
418 cwd = os.path.join(buildroot, 'src', 'scripts') | 418 cwd = os.path.join(buildroot, 'src', 'scripts') |
419 RunCommand(['emerge-%s' % board, '=%s' % chrome_atom_to_build], | 419 RunCommand(['ACCEPT_KEYWORDS="* ~*"', 'emerge-%s' % board, |
| 420 '=%s' % chrome_atom_to_build], |
420 cwd=cwd, enter_chroot=True) | 421 cwd=cwd, enter_chroot=True) |
421 | 422 |
422 | 423 |
423 def _EnableLocalAccount(buildroot): | 424 def _EnableLocalAccount(buildroot): |
424 cwd = os.path.join(buildroot, 'src', 'scripts') | 425 cwd = os.path.join(buildroot, 'src', 'scripts') |
425 # Set local account for test images. | 426 # Set local account for test images. |
426 RunCommand(['./enable_localaccount.sh', | 427 RunCommand(['./enable_localaccount.sh', |
427 'chronos'], | 428 'chronos'], |
428 print_cmd=False, cwd=cwd) | 429 print_cmd=False, cwd=cwd) |
429 | 430 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 cmd.extend(['--upload', 'chromeos-images:/var/www/prebuilt/', | 635 cmd.extend(['--upload', 'chromeos-images:/var/www/prebuilt/', |
635 '--binhost-base-url', 'http://chromeos-prebuilt']) | 636 '--binhost-base-url', 'http://chromeos-prebuilt']) |
636 | 637 |
637 RunCommand(cmd, cwd=cwd) | 638 RunCommand(cmd, cwd=cwd) |
638 | 639 |
639 | 640 |
640 def main(): | 641 def main(): |
641 # Parse options | 642 # Parse options |
642 usage = "usage: %prog [options] cbuildbot_config" | 643 usage = "usage: %prog [options] cbuildbot_config" |
643 parser = optparse.OptionParser(usage=usage) | 644 parser = optparse.OptionParser(usage=usage) |
| 645 parser.add_option('-a', '--acl', default='private', |
| 646 help='ACL to set on GSD archives') |
644 parser.add_option('-r', '--buildroot', | 647 parser.add_option('-r', '--buildroot', |
645 help='root directory where build occurs', default=".") | 648 help='root directory where build occurs', default=".") |
646 parser.add_option('-n', '--buildnumber', | 649 parser.add_option('-n', '--buildnumber', |
647 help='build number', type='int', default=0) | 650 help='build number', type='int', default=0) |
648 parser.add_option('--chrome_rev', default=None, type='string', | 651 parser.add_option('--chrome_rev', default=None, type='string', |
649 dest='chrome_rev', | 652 dest='chrome_rev', |
650 help=('Chrome_rev of type [tot|latest_release|' | 653 help=('Chrome_rev of type [tot|latest_release|' |
651 'sticky_release]')) | 654 'sticky_release]')) |
652 parser.add_option('-f', '--revisionfile', | 655 parser.add_option('-g', '--gsutil', default='', help='Location of gsutil') |
653 help='file where new revisions are stored') | 656 parser.add_option('-c', '--gsutil_archive', default='', |
| 657 help='Datastore archive location') |
654 parser.add_option('--clobber', action='store_true', dest='clobber', | 658 parser.add_option('--clobber', action='store_true', dest='clobber', |
655 default=False, | 659 default=False, |
656 help='Clobbers an old checkout before syncing') | 660 help='Clobbers an old checkout before syncing') |
657 parser.add_option('--debug', action='store_true', dest='debug', | 661 parser.add_option('--debug', action='store_true', dest='debug', |
658 default=False, | 662 default=False, |
659 help='Override some options to run as a developer.') | 663 help='Override some options to run as a developer.') |
| 664 parser.add_option('--noprebuilts', action='store_false', dest='prebuilts', |
| 665 help="Don't upload prebuilts.") |
660 parser.add_option('--nosync', action='store_false', dest='sync', | 666 parser.add_option('--nosync', action='store_false', dest='sync', |
661 default=True, | 667 default=True, |
662 help="Don't sync before building.") | 668 help="Don't sync before building.") |
663 parser.add_option('--notests', action='store_false', dest='tests', | 669 parser.add_option('--notests', action='store_false', dest='tests', |
664 default=True, | 670 default=True, |
665 help='Override values from buildconfig and run no tests.') | 671 help='Override values from buildconfig and run no tests.') |
| 672 parser.add_option('-f', '--revisionfile', |
| 673 help='file where new revisions are stored') |
666 parser.add_option('-t', '--tracking-branch', dest='tracking_branch', | 674 parser.add_option('-t', '--tracking-branch', dest='tracking_branch', |
667 default='cros/master', help='Run the buildbot on a branch') | 675 default='cros/master', help='Run the buildbot on a branch') |
668 parser.add_option('-u', '--url', dest='url', | 676 parser.add_option('-u', '--url', dest='url', |
669 default='http://git.chromium.org/git/manifest', | 677 default='http://git.chromium.org/git/manifest', |
670 help='Run the buildbot on internal manifest') | 678 help='Run the buildbot on internal manifest') |
671 parser.add_option('-g', '--gsutil', default='', help='Location of gsutil') | |
672 parser.add_option('-c', '--gsutil_archive', default='', | |
673 help='Datastore archive location') | |
674 parser.add_option('-a', '--acl', default='private', | |
675 help='ACL to set on GSD archives') | |
676 | 679 |
677 (options, args) = parser.parse_args() | 680 (options, args) = parser.parse_args() |
678 | 681 |
679 buildroot = os.path.abspath(options.buildroot) | 682 buildroot = os.path.abspath(options.buildroot) |
680 revisionfile = options.revisionfile | 683 revisionfile = options.revisionfile |
681 tracking_branch = options.tracking_branch | 684 tracking_branch = options.tracking_branch |
682 chrome_atom_to_build = None | 685 chrome_atom_to_build = None |
683 | 686 |
684 if len(args) >= 1: | 687 if len(args) >= 1: |
685 buildconfig = _GetConfig(args[-1]) | 688 buildconfig = _GetConfig(args[-1]) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 if not os.path.isdir(chroot_path): | 727 if not os.path.isdir(chroot_path): |
725 _MakeChroot(buildroot) | 728 _MakeChroot(buildroot) |
726 | 729 |
727 if not os.path.isdir(boardpath): | 730 if not os.path.isdir(boardpath): |
728 _SetupBoard(buildroot, board=buildconfig['board']) | 731 _SetupBoard(buildroot, board=buildconfig['board']) |
729 | 732 |
730 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds. | 733 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds. |
731 if options.chrome_rev: | 734 if options.chrome_rev: |
732 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, | 735 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, |
733 options.chrome_rev) | 736 options.chrome_rev) |
| 737 # If we found nothing to rev, we're done here. |
| 738 if not chrome_atom_to_build: |
| 739 return |
| 740 |
734 elif buildconfig['uprev']: | 741 elif buildconfig['uprev']: |
735 _UprevPackages(buildroot, tracking_branch, revisionfile, | 742 _UprevPackages(buildroot, tracking_branch, revisionfile, |
736 buildconfig['board'], rev_overlays) | 743 buildconfig['board'], rev_overlays) |
737 | 744 |
738 _EnableLocalAccount(buildroot) | 745 _EnableLocalAccount(buildroot) |
739 # Doesn't rebuild without acquiring more source. | 746 # Doesn't rebuild without acquiring more source. |
740 if options.sync: | 747 if options.sync: |
741 _Build(buildroot, emptytree) | 748 _Build(buildroot, emptytree) |
742 | 749 |
743 if chrome_atom_to_build: | 750 if chrome_atom_to_build: |
(...skipping 17 matching lines...) Expand all Loading... |
761 test_results_dir=test_results_dir, | 768 test_results_dir=test_results_dir, |
762 gsutil=options.gsutil, | 769 gsutil=options.gsutil, |
763 archive_dir=archive_full_path, | 770 archive_dir=archive_full_path, |
764 acl=options.acl) | 771 acl=options.acl) |
765 | 772 |
766 if buildconfig['uprev']: | 773 if buildconfig['uprev']: |
767 # Don't push changes for developers. | 774 # Don't push changes for developers. |
768 if buildconfig['master']: | 775 if buildconfig['master']: |
769 # Master bot needs to check if the other slaves completed. | 776 # Master bot needs to check if the other slaves completed. |
770 if cbuildbot_comm.HaveSlavesCompleted(config): | 777 if cbuildbot_comm.HaveSlavesCompleted(config): |
771 if not options.debug: | 778 if not options.debug and options.prebuilts: |
772 _UploadPrebuilts(buildroot, board, buildconfig['rev_overlays'], | 779 _UploadPrebuilts(buildroot, board, buildconfig['rev_overlays'], |
773 [new_binhost]) | 780 [new_binhost]) |
774 _UprevPush(buildroot, tracking_branch, buildconfig['board'], | 781 _UprevPush(buildroot, tracking_branch, buildconfig['board'], |
775 push_overlays, options.debug) | 782 push_overlays, options.debug) |
776 else: | 783 else: |
777 Die('CBUILDBOT - One of the slaves has failed!!!') | 784 Die('CBUILDBOT - One of the slaves has failed!!!') |
778 | 785 |
779 else: | 786 else: |
780 # Publish my status to the master if its expecting it. | 787 # Publish my status to the master if its expecting it. |
781 if buildconfig['important'] and not options.debug: | 788 if buildconfig['important'] and not options.debug: |
782 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) | 789 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) |
783 | 790 |
784 except: | 791 except: |
785 # Send failure to master bot. | 792 # Send failure to master bot. |
786 if not buildconfig['master'] and buildconfig['important']: | 793 if not buildconfig['master'] and buildconfig['important']: |
787 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 794 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
788 | 795 |
789 raise | 796 raise |
790 | 797 |
791 | 798 |
792 if __name__ == '__main__': | 799 if __name__ == '__main__': |
793 main() | 800 main() |
OLD | NEW |