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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 return binhost.rstrip('\n') | 334 return binhost.rstrip('\n') |
| 335 | 335 |
| 336 | 336 |
| 337 def _SetupBoard(buildroot, board='x86-generic'): | 337 def _SetupBoard(buildroot, board='x86-generic'): |
| 338 """Wrapper around setup_board.""" | 338 """Wrapper around setup_board.""" |
| 339 cwd = os.path.join(buildroot, 'src', 'scripts') | 339 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 340 RunCommand(['./setup_board', '--fast', '--default', '--board=%s' % board], | 340 RunCommand(['./setup_board', '--fast', '--default', '--board=%s' % board], |
| 341 cwd=cwd, enter_chroot=True) | 341 cwd=cwd, enter_chroot=True) |
| 342 | 342 |
| 343 | 343 |
| 344 def _Build(buildroot): | 344 def _Build(buildroot, emptytree): |
| 345 """Wrapper around build_packages.""" | 345 """Wrapper around build_packages.""" |
| 346 cwd = os.path.join(buildroot, 'src', 'scripts') | 346 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 347 RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True) | 347 cmd = ['./build_packages'] |
| 348 if emptytree: | |
| 349 cmd.insert(0, 'EXTRA_BOARD_FLAGS=--emptytree') | |
|
sosa
2010/12/09 18:37:47
extra line
| |
| 350 RunCommand(cmd, cwd=cwd, enter_chroot=True) | |
| 348 | 351 |
| 349 | 352 |
| 350 def _BuildChrome(buildroot, board, chrome_atom_to_build): | 353 def _BuildChrome(buildroot, board, chrome_atom_to_build): |
| 351 """Wrapper for emerge call to build Chrome.""" | 354 """Wrapper for emerge call to build Chrome.""" |
| 352 cwd = os.path.join(buildroot, 'src', 'scripts') | 355 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 353 RunCommand(['emerge-%s' % board, '=%s' % chrome_atom_to_build], | 356 RunCommand(['emerge-%s' % board, '=%s' % chrome_atom_to_build], |
| 354 cwd=cwd, enter_chroot=True) | 357 cwd=cwd, enter_chroot=True) |
| 355 | 358 |
| 356 | 359 |
| 357 def _EnableLocalAccount(buildroot): | 360 def _EnableLocalAccount(buildroot): |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 639 chroot_path = os.path.join(buildroot, 'chroot') | 642 chroot_path = os.path.join(buildroot, 'chroot') |
| 640 boardpath = os.path.join(chroot_path, 'build', board) | 643 boardpath = os.path.join(chroot_path, 'build', board) |
| 641 if options.sync: | 644 if options.sync: |
| 642 if options.clobber or not os.path.isdir(buildroot): | 645 if options.clobber or not os.path.isdir(buildroot): |
| 643 _FullCheckout(buildroot, tracking_branch, url=options.url) | 646 _FullCheckout(buildroot, tracking_branch, url=options.url) |
| 644 else: | 647 else: |
| 645 old_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) | 648 old_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) |
| 646 _IncrementalCheckout(buildroot) | 649 _IncrementalCheckout(buildroot) |
| 647 | 650 |
| 648 new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) | 651 new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST) |
| 649 if old_binhost and old_binhost != new_binhost: | 652 emptytree = (old_binhost and old_binhost != new_binhost) |
| 650 RunCommand(['sudo', 'rm', '-rf', boardpath]) | |
| 651 | 653 |
| 652 # Check that all overlays can be found. | 654 # Check that all overlays can be found. |
| 653 for path in rev_overlays: | 655 for path in rev_overlays: |
| 654 if not os.path.isdir(path): | 656 if not os.path.isdir(path): |
| 655 Die('Missing overlay: %s' % path) | 657 Die('Missing overlay: %s' % path) |
| 656 | 658 |
| 657 if not os.path.isdir(chroot_path): | 659 if not os.path.isdir(chroot_path): |
| 658 _MakeChroot(buildroot) | 660 _MakeChroot(buildroot) |
| 659 | 661 |
| 660 if not os.path.isdir(boardpath): | 662 if not os.path.isdir(boardpath): |
| 661 _SetupBoard(buildroot, board=buildconfig['board']) | 663 _SetupBoard(buildroot, board=buildconfig['board']) |
| 662 | 664 |
| 663 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds. | 665 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds. |
| 664 if options.chrome_rev: | 666 if options.chrome_rev: |
| 665 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, | 667 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, |
| 666 options.chrome_rev) | 668 options.chrome_rev) |
| 667 elif buildconfig['uprev']: | 669 elif buildconfig['uprev']: |
| 668 _UprevPackages(buildroot, tracking_branch, revisionfile, | 670 _UprevPackages(buildroot, tracking_branch, revisionfile, |
| 669 buildconfig['board'], rev_overlays) | 671 buildconfig['board'], rev_overlays) |
| 670 | 672 |
| 671 _EnableLocalAccount(buildroot) | 673 _EnableLocalAccount(buildroot) |
| 672 # Doesn't rebuild without acquiring more source. | 674 # Doesn't rebuild without acquiring more source. |
| 673 if options.sync: | 675 if options.sync: |
| 674 _Build(buildroot) | 676 _Build(buildroot, emptytree) |
| 675 | 677 |
| 676 if chrome_atom_to_build: | 678 if chrome_atom_to_build: |
| 677 _BuildChrome(buildroot, buildconfig['board'], chrome_atom_to_build) | 679 _BuildChrome(buildroot, buildconfig['board'], chrome_atom_to_build) |
| 678 | 680 |
| 679 if buildconfig['unittests'] and options.tests: | 681 if buildconfig['unittests'] and options.tests: |
| 680 _RunUnitTests(buildroot) | 682 _RunUnitTests(buildroot) |
| 681 | 683 |
| 682 _BuildImage(buildroot) | 684 _BuildImage(buildroot) |
| 683 | 685 |
| 684 if buildconfig['smoke_bvt'] and options.tests: | 686 if buildconfig['smoke_bvt'] and options.tests: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 717 except: | 719 except: |
| 718 # Send failure to master bot. | 720 # Send failure to master bot. |
| 719 if not buildconfig['master'] and buildconfig['important']: | 721 if not buildconfig['master'] and buildconfig['important']: |
| 720 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 722 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
| 721 | 723 |
| 722 raise | 724 raise |
| 723 | 725 |
| 724 | 726 |
| 725 if __name__ == '__main__': | 727 if __name__ == '__main__': |
| 726 main() | 728 main() |
| OLD | NEW |