| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 | 320 |
| 321 def _IncrementalCheckout(buildroot, retries=_DEFAULT_RETRIES): | 321 def _IncrementalCheckout(buildroot, retries=_DEFAULT_RETRIES): |
| 322 """Performs a checkout without clobbering previous checkout.""" | 322 """Performs a checkout without clobbering previous checkout.""" |
| 323 RepoSync(buildroot, retries) | 323 RepoSync(buildroot, retries) |
| 324 | 324 |
| 325 | 325 |
| 326 def _MakeChroot(buildroot, replace=False): | 326 def _MakeChroot(buildroot, replace=False): |
| 327 """Wrapper around make_chroot.""" | 327 """Wrapper around make_chroot.""" |
| 328 cwd = os.path.join(buildroot, 'src', 'scripts') | 328 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 329 | 329 |
| 330 cmd = ['./make_chroot', '--fast'] | 330 cmd = ['./make_chroot', '--fast'] |
| 331 | 331 |
| 332 if replace: | 332 if replace: |
| 333 cmd.append('--replace') | 333 cmd.append('--replace') |
| 334 | 334 |
| 335 RunCommand(cmd, cwd=cwd) | 335 RunCommand(cmd, cwd=cwd) |
| 336 | 336 |
| 337 | 337 |
| 338 def _GetPortageEnvVar(buildroot, board, envvar): | 338 def _GetPortageEnvVar(buildroot, board, envvar): |
| 339 """Get a portage environment variable for the specified board, if any. | 339 """Get a portage environment variable for the specified board, if any. |
| 340 | 340 |
| 341 buildroot: The root directory where the build occurs. Must be an absolute | 341 buildroot: The root directory where the build occurs. Must be an absolute |
| 342 path. | 342 path. |
| 343 board: Board type that was built on this machine. E.g. x86-generic. If this | 343 board: Board type that was built on this machine. E.g. x86-generic. If this |
| 344 is None, get the env var from the host. | 344 is None, get the env var from the host. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 367 def _Build(buildroot, emptytree, build_autotest=True, usepkg=True): | 367 def _Build(buildroot, emptytree, build_autotest=True, usepkg=True): |
| 368 """Wrapper around build_packages.""" | 368 """Wrapper around build_packages.""" |
| 369 cwd = os.path.join(buildroot, 'src', 'scripts') | 369 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 370 if emptytree: | 370 if emptytree: |
| 371 cmd = ['sh', '-c', 'EXTRA_BOARD_FLAGS=--emptytree ./build_packages'] | 371 cmd = ['sh', '-c', 'EXTRA_BOARD_FLAGS=--emptytree ./build_packages'] |
| 372 else: | 372 else: |
| 373 cmd = ['./build_packages'] | 373 cmd = ['./build_packages'] |
| 374 | 374 |
| 375 if not build_autotest: | 375 if not build_autotest: |
| 376 cmd.append('--nowithautotest') | 376 cmd.append('--nowithautotest') |
| 377 | 377 |
| 378 if not usepkg: | 378 if not usepkg: |
| 379 cmd.append('--nousepkg') | 379 cmd.append('--nousepkg') |
| 380 | 380 |
| 381 RunCommand(cmd, cwd=cwd, enter_chroot=True) | 381 RunCommand(cmd, cwd=cwd, enter_chroot=True) |
| 382 | 382 |
| 383 | 383 |
| 384 def _EnableLocalAccount(buildroot): | 384 def _EnableLocalAccount(buildroot): |
| 385 cwd = os.path.join(buildroot, 'src', 'scripts') | 385 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 386 # Set local account for test images. | 386 # Set local account for test images. |
| 387 RunCommand(['./enable_localaccount.sh', | 387 RunCommand(['./enable_localaccount.sh', |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 for path in rev_overlays: | 731 for path in rev_overlays: |
| 732 if not os.path.isdir(path): | 732 if not os.path.isdir(path): |
| 733 Die('Missing overlay: %s' % path) | 733 Die('Missing overlay: %s' % path) |
| 734 | 734 |
| 735 if not os.path.isdir(chroot_path): | 735 if not os.path.isdir(chroot_path): |
| 736 _MakeChroot(buildroot, buildconfig['chroot_replace']) | 736 _MakeChroot(buildroot, buildconfig['chroot_replace']) |
| 737 | 737 |
| 738 if not os.path.isdir(boardpath): | 738 if not os.path.isdir(boardpath): |
| 739 _SetupBoard(buildroot, board=buildconfig['board']) | 739 _SetupBoard(buildroot, board=buildconfig['board']) |
| 740 | 740 |
| 741 # Perform chrome uprev. | 741 # Perform uprev. If chrome_uprev is set, rev Chrome ebuilds. |
| 742 if options.chrome_rev: | 742 if options.chrome_rev: |
| 743 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, | 743 chrome_atom_to_build = _MarkChromeAsStable(buildroot, tracking_branch, |
| 744 options.chrome_rev, board) | 744 options.chrome_rev, board) |
| 745 # Perform other uprevs. | 745 # If we found nothing to rev, we're done here. |
| 746 if buildconfig['uprev']: | 746 if not chrome_atom_to_build: |
| 747 return |
| 748 |
| 749 elif buildconfig['uprev']: |
| 747 _UprevPackages(buildroot, tracking_branch, revisionfile, | 750 _UprevPackages(buildroot, tracking_branch, revisionfile, |
| 748 buildconfig['board'], rev_overlays) | 751 buildconfig['board'], rev_overlays) |
| 749 elif not chrome_atom_to_build: | |
| 750 # We found nothing to rev, we're done here. | |
| 751 return | |
| 752 | 752 |
| 753 _EnableLocalAccount(buildroot) | 753 _EnableLocalAccount(buildroot) |
| 754 | 754 |
| 755 if options.build: | 755 if options.build: |
| 756 _Build(buildroot, | 756 _Build(buildroot, |
| 757 emptytree, | 757 emptytree, |
| 758 build_autotest=(buildconfig['vm_tests'] and options.tests), | 758 build_autotest=(buildconfig['vm_tests'] and options.tests), |
| 759 usepkg=buildconfig['usepkg']) | 759 usepkg=buildconfig['usepkg']) |
| 760 | 760 |
| 761 if buildconfig['unittests'] and options.tests: | 761 if buildconfig['unittests'] and options.tests: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 except: | 805 except: |
| 806 # Send failure to master bot. | 806 # Send failure to master bot. |
| 807 if not buildconfig['master'] and buildconfig['important']: | 807 if not buildconfig['master'] and buildconfig['important']: |
| 808 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 808 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
| 809 | 809 |
| 810 raise | 810 raise |
| 811 | 811 |
| 812 | 812 |
| 813 if __name__ == '__main__': | 813 if __name__ == '__main__': |
| 814 main() | 814 main() |
| OLD | NEW |