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

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: 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') | bin/cbuildbot_config.py » ('J')
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))
David James 2010/12/02 02:06:59 Maybe we should also check that push_overlays must
sosa 2010/12/02 21:47:49 Done.
631
627 board = buildconfig['board'] 632 board = buildconfig['board']
628 old_binhost = None 633 old_binhost = None
629 634
630 _PreFlightRinse(buildroot, buildconfig['board'], tracking_branch, overlays) 635 _PreFlightRinse(buildroot, buildconfig['board'], tracking_branch,
636 rev_overlays)
631 chroot_path = os.path.join(buildroot, 'chroot') 637 chroot_path = os.path.join(buildroot, 'chroot')
632 boardpath = os.path.join(chroot_path, 'build', board) 638 boardpath = os.path.join(chroot_path, 'build', board)
633 if options.sync: 639 if options.sync:
634 if options.clobber or not os.path.isdir(buildroot): 640 if options.clobber or not os.path.isdir(buildroot):
635 _FullCheckout(buildroot, tracking_branch, url=options.url) 641 _FullCheckout(buildroot, tracking_branch, url=options.url)
636 else: 642 else:
637 old_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) 643 old_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST)
638 _IncrementalCheckout(buildroot) 644 _IncrementalCheckout(buildroot)
639 645
640 new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) 646 new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST)
641 if old_binhost and old_binhost != new_binhost: 647 if old_binhost and old_binhost != new_binhost:
642 RunCommand(['sudo', 'rm', '-rf', boardpath]) 648 RunCommand(['sudo', 'rm', '-rf', boardpath])
643 649
644 # Check that all overlays can be found. 650 # Check that all overlays can be found.
645 for path in overlays: 651 for path in rev_overlays:
646 assert ':' not in path, 'Overlay must not contain colons: %s' % path
David James 2010/12/02 02:06:59 Thanks for cleaning this up -- it wasn't terribly
647 if not os.path.isdir(path): 652 if not os.path.isdir(path):
648 Die('Missing overlay: %s' % path) 653 Die('Missing overlay: %s' % path)
649 654
650 if not os.path.isdir(chroot_path): 655 if not os.path.isdir(chroot_path):
651 _MakeChroot(buildroot) 656 _MakeChroot(buildroot)
652 657
653 if not os.path.isdir(boardpath): 658 if not os.path.isdir(boardpath):
654 _SetupBoard(buildroot, board=buildconfig['board']) 659 _SetupBoard(buildroot, board=buildconfig['board'])
655 660
656 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds. 661 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds.
657 if options.chrome_rev: 662 if options.chrome_rev:
658 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, 663 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch,
659 options.chrome_rev) 664 options.chrome_rev)
660 elif buildconfig['uprev']: 665 elif buildconfig['uprev']:
661 _UprevPackages(buildroot, tracking_branch, revisionfile, 666 _UprevPackages(buildroot, tracking_branch, revisionfile,
662 buildconfig['board'], overlays) 667 buildconfig['board'], rev_overlays)
663 668
664 _EnableLocalAccount(buildroot) 669 _EnableLocalAccount(buildroot)
665 # Doesn't rebuild without acquiring more source. 670 # Doesn't rebuild without acquiring more source.
666 if options.sync: 671 if options.sync:
667 _Build(buildroot) 672 _Build(buildroot)
668 673
669 if chrome_atom_to_build: 674 if chrome_atom_to_build:
670 _BuildChrome(buildroot, buildconfig['board'], chrome_atom_to_build) 675 _BuildChrome(buildroot, buildconfig['board'], chrome_atom_to_build)
671 676
672 if buildconfig['unittests'] and options.tests: 677 if buildconfig['unittests'] and options.tests:
673 _RunUnitTests(buildroot) 678 _RunUnitTests(buildroot)
674 679
675 _BuildImage(buildroot) 680 _BuildImage(buildroot)
676 681
677 if buildconfig['smoke_bvt'] and options.tests: 682 if buildconfig['smoke_bvt'] and options.tests:
678 _BuildVMImageForTesting(buildroot) 683 _BuildVMImageForTesting(buildroot)
679 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber 684 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber
680 try: 685 try:
681 _RunSmokeSuite(buildroot, test_results_dir) 686 _RunSmokeSuite(buildroot, test_results_dir)
682 finally: 687 finally:
683 if not options.debug: 688 if not options.debug:
684 archive_full_path=os.path.join(options.gsutil_archive, 689 archive_full_path = os.path.join(options.gsutil_archive,
685 str(options.buildnumber)) 690 str(options.buildnumber))
686 _ArchiveTestResults(buildroot, buildconfig['board'], 691 _ArchiveTestResults(buildroot, buildconfig['board'],
687 test_results_dir=test_results_dir, 692 test_results_dir=test_results_dir,
688 gsutil=options.gsutil, 693 gsutil=options.gsutil,
689 archive_dir=archive_full_path, 694 archive_dir=archive_full_path,
690 acl=options.acl) 695 acl=options.acl)
691 696
692 if buildconfig['uprev']: 697 if buildconfig['uprev']:
693 # Don't push changes for developers. 698 # Don't push changes for developers.
694 if buildconfig['master']: 699 if buildconfig['master']:
695 # Master bot needs to check if the other slaves completed. 700 # Master bot needs to check if the other slaves completed.
696 if cbuildbot_comm.HaveSlavesCompleted(config): 701 if cbuildbot_comm.HaveSlavesCompleted(config):
697 _UploadPrebuilts(buildroot, board, buildconfig['overlays'], 702 _UploadPrebuilts(buildroot, board, rev_overlays,
David James 2010/12/02 02:06:59 _UploadPrebuilts expects a string for the third ar
sosa 2010/12/02 21:47:49 Done.
698 [new_binhost]) 703 [new_binhost])
699 _UprevPush(buildroot, tracking_branch, buildconfig['board'], 704 _UprevPush(buildroot, tracking_branch, buildconfig['board'],
700 overlays, options.debug) 705 push_overlays, options.debug)
701 else: 706 else:
702 Die('CBUILDBOT - One of the slaves has failed!!!') 707 Die('CBUILDBOT - One of the slaves has failed!!!')
703 708
704 else: 709 else:
705 # Publish my status to the master if its expecting it. 710 # Publish my status to the master if its expecting it.
706 if buildconfig['important'] and not options.debug: 711 if buildconfig['important'] and not options.debug:
707 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) 712 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE)
708 713
709 except: 714 except:
710 # Send failure to master bot. 715 # Send failure to master bot.
711 if not buildconfig['master'] and buildconfig['important']: 716 if not buildconfig['master'] and buildconfig['important']:
712 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) 717 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED)
713 718
714 raise 719 raise
715 720
716 721
717 if __name__ == '__main__': 722 if __name__ == '__main__':
718 main() 723 main()
OLDNEW
« no previous file with comments | « no previous file | bin/cbuildbot_config.py » ('j') | bin/cbuildbot_config.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698