Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: bin/cbuildbot.py

Issue 5531002: Add ability to push to subset of overlays we rev. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Fixes from review Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | bin/cbuildbot_config.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 """ 525 """
526 public_overlay = '%s/src/third_party/chromiumos-overlay' % buildroot 526 public_overlay = '%s/src/third_party/chromiumos-overlay' % buildroot
527 private_overlay = '%s/src/private-overlays/chromeos-overlay' % buildroot 527 private_overlay = '%s/src/private-overlays/chromeos-overlay' % buildroot
528 if overlays == 'private': 528 if overlays == 'private':
529 paths = [private_overlay] 529 paths = [private_overlay]
530 elif overlays == 'public': 530 elif overlays == 'public':
531 paths = [public_overlay] 531 paths = [public_overlay]
532 elif overlays == 'both': 532 elif overlays == 'both':
533 paths = [public_overlay, private_overlay] 533 paths = [public_overlay, private_overlay]
534 else: 534 else:
535 Die('Incorrect overlay configuration: %s' % overlays) 535 Info('No overlays found.')
536 paths = []
536 return paths 537 return paths
537 538
538 539
539 def _UploadPrebuilts(buildroot, board, overlay_config, binhosts): 540 def _UploadPrebuilts(buildroot, board, overlay_config, binhosts):
540 """Upload prebuilts. 541 """Upload prebuilts.
541 542
542 Args: 543 Args:
543 buildroot: The root directory where the build occurs. 544 buildroot: The root directory where the build occurs.
544 board: Board type that was built on this machine 545 board: Board type that was built on this machine
545 overlay_config: A string describing which overlays you want. 546 overlay_config: A string describing which overlays you want.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 617
617 if len(args) >= 1: 618 if len(args) >= 1:
618 buildconfig = _GetConfig(args[-1]) 619 buildconfig = _GetConfig(args[-1])
619 else: 620 else:
620 Warning('Missing configuration description') 621 Warning('Missing configuration description')
621 parser.print_usage() 622 parser.print_usage()
622 sys.exit(1) 623 sys.exit(1)
623 624
624 try: 625 try:
625 # Calculate list of overlay directories. 626 # Calculate list of overlay directories.
626 overlays = _ResolveOverlays(buildroot, buildconfig['overlays']) 627 rev_overlays = _ResolveOverlays(buildroot, buildconfig['rev_overlays'])
628 push_overlays = _ResolveOverlays(buildroot, buildconfig['push_overlays'])
629 # We cannot push to overlays that we don't rev.
630 assert set(push_overlays).issubset(set(rev_overlays))
631 # Either has to be a master or not have any push overlays.
632 assert buildconfig['master'] or not push_overlays
633
627 board = buildconfig['board'] 634 board = buildconfig['board']
628 old_binhost = None 635 old_binhost = None
629 636
630 _PreFlightRinse(buildroot, buildconfig['board'], tracking_branch, overlays) 637 _PreFlightRinse(buildroot, buildconfig['board'], tracking_branch,
638 rev_overlays)
631 chroot_path = os.path.join(buildroot, 'chroot') 639 chroot_path = os.path.join(buildroot, 'chroot')
632 boardpath = os.path.join(chroot_path, 'build', board) 640 boardpath = os.path.join(chroot_path, 'build', board)
633 if options.sync: 641 if options.sync:
634 if options.clobber or not os.path.isdir(buildroot): 642 if options.clobber or not os.path.isdir(buildroot):
635 _FullCheckout(buildroot, tracking_branch, url=options.url) 643 _FullCheckout(buildroot, tracking_branch, url=options.url)
636 else: 644 else:
637 old_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) 645 old_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST)
638 _IncrementalCheckout(buildroot) 646 _IncrementalCheckout(buildroot)
639 647
640 new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) 648 new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST)
641 if old_binhost and old_binhost != new_binhost: 649 if old_binhost and old_binhost != new_binhost:
642 RunCommand(['sudo', 'rm', '-rf', boardpath]) 650 RunCommand(['sudo', 'rm', '-rf', boardpath])
643 651
644 # Check that all overlays can be found. 652 # Check that all overlays can be found.
645 for path in overlays: 653 for path in rev_overlays:
646 assert ':' not in path, 'Overlay must not contain colons: %s' % path
647 if not os.path.isdir(path): 654 if not os.path.isdir(path):
648 Die('Missing overlay: %s' % path) 655 Die('Missing overlay: %s' % path)
649 656
650 if not os.path.isdir(chroot_path): 657 if not os.path.isdir(chroot_path):
651 _MakeChroot(buildroot) 658 _MakeChroot(buildroot)
652 659
653 if not os.path.isdir(boardpath): 660 if not os.path.isdir(boardpath):
654 _SetupBoard(buildroot, board=buildconfig['board']) 661 _SetupBoard(buildroot, board=buildconfig['board'])
655 662
656 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds. 663 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds.
657 if options.chrome_rev: 664 if options.chrome_rev:
658 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, 665 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch,
659 options.chrome_rev) 666 options.chrome_rev)
660 elif buildconfig['uprev']: 667 elif buildconfig['uprev']:
661 _UprevPackages(buildroot, tracking_branch, revisionfile, 668 _UprevPackages(buildroot, tracking_branch, revisionfile,
662 buildconfig['board'], overlays) 669 buildconfig['board'], rev_overlays)
663 670
664 _EnableLocalAccount(buildroot) 671 _EnableLocalAccount(buildroot)
665 # Doesn't rebuild without acquiring more source. 672 # Doesn't rebuild without acquiring more source.
666 if options.sync: 673 if options.sync:
667 _Build(buildroot) 674 _Build(buildroot)
668 675
669 if chrome_atom_to_build: 676 if chrome_atom_to_build:
670 _BuildChrome(buildroot, buildconfig['board'], chrome_atom_to_build) 677 _BuildChrome(buildroot, buildconfig['board'], chrome_atom_to_build)
671 678
672 if buildconfig['unittests'] and options.tests: 679 if buildconfig['unittests'] and options.tests:
673 _RunUnitTests(buildroot) 680 _RunUnitTests(buildroot)
674 681
675 _BuildImage(buildroot) 682 _BuildImage(buildroot)
676 683
677 if buildconfig['smoke_bvt'] and options.tests: 684 if buildconfig['smoke_bvt'] and options.tests:
678 _BuildVMImageForTesting(buildroot) 685 _BuildVMImageForTesting(buildroot)
679 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber 686 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber
680 try: 687 try:
681 _RunSmokeSuite(buildroot, test_results_dir) 688 _RunSmokeSuite(buildroot, test_results_dir)
682 finally: 689 finally:
683 if not options.debug: 690 if not options.debug:
684 archive_full_path=os.path.join(options.gsutil_archive, 691 archive_full_path = os.path.join(options.gsutil_archive,
685 str(options.buildnumber)) 692 str(options.buildnumber))
686 _ArchiveTestResults(buildroot, buildconfig['board'], 693 _ArchiveTestResults(buildroot, buildconfig['board'],
687 test_results_dir=test_results_dir, 694 test_results_dir=test_results_dir,
688 gsutil=options.gsutil, 695 gsutil=options.gsutil,
689 archive_dir=archive_full_path, 696 archive_dir=archive_full_path,
690 acl=options.acl) 697 acl=options.acl)
691 698
692 if buildconfig['uprev']: 699 if buildconfig['uprev']:
693 # Don't push changes for developers. 700 # Don't push changes for developers.
694 if buildconfig['master']: 701 if buildconfig['master']:
695 # Master bot needs to check if the other slaves completed. 702 # Master bot needs to check if the other slaves completed.
696 if cbuildbot_comm.HaveSlavesCompleted(config): 703 if cbuildbot_comm.HaveSlavesCompleted(config):
697 _UploadPrebuilts(buildroot, board, buildconfig['overlays'], 704 _UploadPrebuilts(buildroot, board, buildconfig['rev_overlays'],
698 [new_binhost]) 705 [new_binhost])
699 _UprevPush(buildroot, tracking_branch, buildconfig['board'], 706 _UprevPush(buildroot, tracking_branch, buildconfig['board'],
700 overlays, options.debug) 707 push_overlays, options.debug)
701 else: 708 else:
702 Die('CBUILDBOT - One of the slaves has failed!!!') 709 Die('CBUILDBOT - One of the slaves has failed!!!')
703 710
704 else: 711 else:
705 # Publish my status to the master if its expecting it. 712 # Publish my status to the master if its expecting it.
706 if buildconfig['important'] and not options.debug: 713 if buildconfig['important'] and not options.debug:
707 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) 714 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE)
708 715
709 except: 716 except:
710 # Send failure to master bot. 717 # Send failure to master bot.
711 if not buildconfig['master'] and buildconfig['important']: 718 if not buildconfig['master'] and buildconfig['important']:
712 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) 719 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED)
713 720
714 raise 721 raise
715 722
716 723
717 if __name__ == '__main__': 724 if __name__ == '__main__':
718 main() 725 main()
OLDNEW
« no previous file with comments | « no previous file | bin/cbuildbot_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698