| 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 |
| 11 import re | 11 import re |
| 12 import optparse | 12 import optparse |
| 13 import os | 13 import os |
| 14 import shutil | 14 import shutil |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 import cbuildbot_comm | 17 import cbuildbot_comm |
| 18 from cbuildbot_config import config | 18 from cbuildbot_config import config |
| 19 | 19 |
| 20 sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) | 20 sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) |
| 21 from cros_build_lib import Die, Info, RunCommand, Warning | 21 from cros_build_lib import (Die, Info, ReinterpretPathForChroot, RunCommand, |
| 22 Warning) |
| 22 | 23 |
| 23 _DEFAULT_RETRIES = 3 | 24 _DEFAULT_RETRIES = 3 |
| 24 ARCHIVE_BASE = '/var/www/archive' | 25 ARCHIVE_BASE = '/var/www/archive' |
| 25 ARCHIVE_COUNT = 10 | 26 ARCHIVE_COUNT = 10 |
| 26 | 27 |
| 27 # ======================== Utility functions ================================ | 28 # ======================== Utility functions ================================ |
| 28 | 29 |
| 29 def MakeDir(path, parents=False): | 30 def MakeDir(path, parents=False): |
| 30 """Basic wrapper around os.mkdirs. | 31 """Basic wrapper around os.mkdirs. |
| 31 | 32 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 repo_name = revision_tuple[0].replace('.git', '') | 175 repo_name = revision_tuple[0].replace('.git', '') |
| 175 # Might not have entry if no matching ebuild. | 176 # Might not have entry if no matching ebuild. |
| 176 if repo_dictionary.has_key(repo_name): | 177 if repo_dictionary.has_key(repo_name): |
| 177 # May be many corresponding packages to a given git repo e.g. kernel). | 178 # May be many corresponding packages to a given git repo e.g. kernel). |
| 178 for package in repo_dictionary[repo_name]: | 179 for package in repo_dictionary[repo_name]: |
| 179 revisions[package] = revision_tuple[1] | 180 revisions[package] = revision_tuple[1] |
| 180 | 181 |
| 181 return revisions.items() | 182 return revisions.items() |
| 182 | 183 |
| 183 | 184 |
| 184 def _UprevFromRevisionList(buildroot, tracking_branch, revision_list, board): | 185 def _UprevFromRevisionList(buildroot, tracking_branch, revision_list, board, |
| 186 overlays): |
| 185 """Uprevs based on revision list.""" | 187 """Uprevs based on revision list.""" |
| 186 if not revision_list: | 188 if not revision_list: |
| 187 Info('No packages found to uprev') | 189 Info('No packages found to uprev') |
| 188 return | 190 return |
| 189 | 191 |
| 190 package_str = '' | 192 packages = [] |
| 191 for package, revision in revision_list: | 193 for package, revision in revision_list: |
| 192 package_str += package + ' ' | 194 assert ':' not in package, 'Invalid package name: %s' % package |
| 195 packages.append(package) |
| 193 | 196 |
| 194 package_str = package_str.strip() | 197 chroot_overlays = [ReinterpretPathForChroot(path) for path in overlays] |
| 195 | 198 |
| 196 cwd = os.path.join(buildroot, 'src', 'scripts') | 199 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 197 # TODO(davidjames): --foo="bar baz" only works here because we're using | |
| 198 # enter_chroot. | |
| 199 RunCommand(['./cros_mark_as_stable', | 200 RunCommand(['./cros_mark_as_stable', |
| 200 '--board=%s' % board, | 201 '--board=%s' % board, |
| 201 '--tracking_branch="%s"' % tracking_branch, | 202 '--tracking_branch=%s' % tracking_branch, |
| 202 '--packages="%s"' % package_str, | 203 '--overlays=%s' % ':'.join(chroot_overlays), |
| 204 '--packages=%s' % ':'.join(packages), |
| 203 'commit'], | 205 'commit'], |
| 206 cwd=cwd, enter_chroot=True) |
| 207 |
| 208 |
| 209 def _UprevAllPackages(buildroot, tracking_branch, board, overlays): |
| 210 """Uprevs all packages that have been updated since last uprev.""" |
| 211 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 212 chroot_overlays = [ReinterpretPathForChroot(path) for path in overlays] |
| 213 RunCommand(['./cros_mark_as_stable', '--all', |
| 214 '--board=%s' % board, |
| 215 '--overlays=%s' % ':'.join(chroot_overlays), |
| 216 '--tracking_branch=%s' % tracking_branch, 'commit'], |
| 204 cwd=cwd, enter_chroot=True) | 217 cwd=cwd, enter_chroot=True) |
| 205 | 218 |
| 206 | 219 |
| 207 def _UprevAllPackages(buildroot, tracking_branch, board): | |
| 208 """Uprevs all packages that have been updated since last uprev.""" | |
| 209 cwd = os.path.join(buildroot, 'src', 'scripts') | |
| 210 # TODO(davidjames): --foo="bar baz" only works here because we're using | |
| 211 # enter_chroot. | |
| 212 RunCommand(['./cros_mark_as_stable', '--all', | |
| 213 '--board=%s' % board, | |
| 214 '--tracking_branch="%s"' % tracking_branch, 'commit'], | |
| 215 cwd=cwd, enter_chroot=True) | |
| 216 | |
| 217 | |
| 218 def _GetVMConstants(buildroot): | 220 def _GetVMConstants(buildroot): |
| 219 """Returns minimum (vdisk_size, statefulfs_size) recommended for VM's.""" | 221 """Returns minimum (vdisk_size, statefulfs_size) recommended for VM's.""" |
| 220 cwd = os.path.join(buildroot, 'src', 'scripts', 'lib') | 222 cwd = os.path.join(buildroot, 'src', 'scripts', 'lib') |
| 221 source_cmd = 'source %s/cros_vm_constants.sh' % cwd | 223 source_cmd = 'source %s/cros_vm_constants.sh' % cwd |
| 222 vdisk_size = RunCommand([ | 224 vdisk_size = RunCommand([ |
| 223 '/bin/bash', '-c', '%s && echo $MIN_VDISK_SIZE_FULL' % source_cmd], | 225 '/bin/bash', '-c', '%s && echo $MIN_VDISK_SIZE_FULL' % source_cmd], |
| 224 redirect_stdout=True) | 226 redirect_stdout=True) |
| 225 statefulfs_size = RunCommand([ | 227 statefulfs_size = RunCommand([ |
| 226 '/bin/bash', '-c', '%s && echo $MIN_STATEFUL_FS_SIZE_FULL' % source_cmd], | 228 '/bin/bash', '-c', '%s && echo $MIN_STATEFUL_FS_SIZE_FULL' % source_cmd], |
| 227 redirect_stdout=True) | 229 redirect_stdout=True) |
| 228 return (vdisk_size.strip(), statefulfs_size.strip()) | 230 return (vdisk_size.strip(), statefulfs_size.strip()) |
| 229 | 231 |
| 230 | 232 |
| 231 def _GitCleanup(buildroot, board, tracking_branch): | 233 def _GitCleanup(buildroot, board, tracking_branch, overlays): |
| 232 """Clean up git branch after previous uprev attempt.""" | 234 """Clean up git branch after previous uprev attempt.""" |
| 233 cwd = os.path.join(buildroot, 'src', 'scripts') | 235 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 234 if os.path.exists(cwd): | 236 if os.path.exists(cwd): |
| 235 RunCommand(['./cros_mark_as_stable', '--srcroot=..', | 237 RunCommand(['./cros_mark_as_stable', '--srcroot=..', |
| 236 '--board=%s' % board, | 238 '--board=%s' % board, |
| 239 '--overlays=%s' % ':'.join(overlays), |
| 237 '--tracking_branch=%s' % tracking_branch, 'clean'], | 240 '--tracking_branch=%s' % tracking_branch, 'clean'], |
| 238 cwd=cwd, error_ok=True) | 241 cwd=cwd, error_ok=True) |
| 239 | 242 |
| 240 | 243 |
| 241 def _CleanUpMountPoints(buildroot): | 244 def _CleanUpMountPoints(buildroot): |
| 242 """Cleans up any stale mount points from previous runs.""" | 245 """Cleans up any stale mount points from previous runs.""" |
| 243 mount_output = RunCommand(['mount'], redirect_stdout=True) | 246 mount_output = RunCommand(['mount'], redirect_stdout=True) |
| 244 mount_pts_in_buildroot = RunCommand(['grep', buildroot], input=mount_output, | 247 mount_pts_in_buildroot = RunCommand(['grep', buildroot], input=mount_output, |
| 245 redirect_stdout=True, error_ok=True) | 248 redirect_stdout=True, error_ok=True) |
| 246 | 249 |
| 247 for mount_pt_str in mount_pts_in_buildroot.splitlines(): | 250 for mount_pt_str in mount_pts_in_buildroot.splitlines(): |
| 248 mount_pt = mount_pt_str.rpartition(' type ')[0].partition(' on ')[2] | 251 mount_pt = mount_pt_str.rpartition(' type ')[0].partition(' on ')[2] |
| 249 RunCommand(['sudo', 'umount', '-l', mount_pt], error_ok=True) | 252 RunCommand(['sudo', 'umount', '-l', mount_pt], error_ok=True) |
| 250 | 253 |
| 251 | 254 |
| 252 def _WipeOldOutput(buildroot): | 255 def _WipeOldOutput(buildroot): |
| 253 """Wipes out build output directories.""" | 256 """Wipes out build output directories.""" |
| 254 RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot) | 257 RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot) |
| 255 | 258 |
| 256 | 259 |
| 257 # =========================== Main Commands =================================== | 260 # =========================== Main Commands =================================== |
| 258 | 261 |
| 259 | 262 |
| 260 def _PreFlightRinse(buildroot, board, tracking_branch): | 263 def _PreFlightRinse(buildroot, board, tracking_branch, overlays): |
| 261 """Cleans up any leftover state from previous runs.""" | 264 """Cleans up any leftover state from previous runs.""" |
| 262 _GitCleanup(buildroot, board, tracking_branch) | 265 _GitCleanup(buildroot, board, tracking_branch, overlays) |
| 263 _CleanUpMountPoints(buildroot) | 266 _CleanUpMountPoints(buildroot) |
| 264 RunCommand(['sudo', 'killall', 'kvm'], error_ok=True) | 267 RunCommand(['sudo', 'killall', 'kvm'], error_ok=True) |
| 265 | 268 |
| 266 | 269 |
| 267 def _FullCheckout(buildroot, tracking_branch, rw_checkout=True, | 270 def _FullCheckout(buildroot, tracking_branch, rw_checkout=True, |
| 268 retries=_DEFAULT_RETRIES, | 271 retries=_DEFAULT_RETRIES, |
| 269 url='http://git.chromium.org/git/manifest'): | 272 url='http://git.chromium.org/git/manifest'): |
| 270 """Performs a full checkout and clobbers any previous checkouts.""" | 273 """Performs a full checkout and clobbers any previous checkouts.""" |
| 271 RunCommand(['sudo', 'rm', '-rf', buildroot]) | 274 RunCommand(['sudo', 'rm', '-rf', buildroot]) |
| 272 MakeDir(buildroot, parents=True) | 275 MakeDir(buildroot, parents=True) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 shutil.rmtree(results_dir_in_chroot) | 343 shutil.rmtree(results_dir_in_chroot) |
| 341 | 344 |
| 342 cwd = os.path.join(buildroot, 'src', 'scripts') | 345 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 343 RunCommand(['bin/cros_run_vm_test', | 346 RunCommand(['bin/cros_run_vm_test', |
| 344 '--no_graphics', | 347 '--no_graphics', |
| 345 '--test_case=suite_Smoke', | 348 '--test_case=suite_Smoke', |
| 346 '--results_dir_root=%s' % results_dir, | 349 '--results_dir_root=%s' % results_dir, |
| 347 ], cwd=cwd, error_ok=False) | 350 ], cwd=cwd, error_ok=False) |
| 348 | 351 |
| 349 | 352 |
| 350 def _UprevPackages(buildroot, tracking_branch, revisionfile, board): | 353 def _UprevPackages(buildroot, tracking_branch, revisionfile, board, overlays): |
| 351 """Uprevs a package based on given revisionfile. | 354 """Uprevs a package based on given revisionfile. |
| 352 | 355 |
| 353 If revisionfile is set to None or does not resolve to an actual file, this | 356 If revisionfile is set to None or does not resolve to an actual file, this |
| 354 function will uprev all packages. | 357 function will uprev all packages. |
| 355 | 358 |
| 356 Keyword arguments: | 359 Keyword arguments: |
| 357 revisionfile -- string specifying a file that contains a list of revisions to | 360 revisionfile -- string specifying a file that contains a list of revisions to |
| 358 uprev. | 361 uprev. |
| 359 """ | 362 """ |
| 360 # Purposefully set to None as it means Force Build was pressed. | 363 # Purposefully set to None as it means Force Build was pressed. |
| 361 revisions = 'None' | 364 revisions = 'None' |
| 362 if (revisionfile): | 365 if (revisionfile): |
| 363 try: | 366 try: |
| 364 rev_file = open(revisionfile) | 367 rev_file = open(revisionfile) |
| 365 revisions = rev_file.read() | 368 revisions = rev_file.read() |
| 366 rev_file.close() | 369 rev_file.close() |
| 367 except Exception, e: | 370 except Exception, e: |
| 368 Warning('Error reading %s, revving all' % revisionfile) | 371 Warning('Error reading %s, revving all' % revisionfile) |
| 369 revisions = 'None' | 372 revisions = 'None' |
| 370 | 373 |
| 371 revisions = revisions.strip() | 374 revisions = revisions.strip() |
| 372 | 375 |
| 373 # TODO(sosa): Un-comment once we close individual trees. | 376 # TODO(sosa): Un-comment once we close individual trees. |
| 374 # revisions == "None" indicates a Force Build. | 377 # revisions == "None" indicates a Force Build. |
| 375 #if revisions != 'None': | 378 #if revisions != 'None': |
| 376 # print >> sys.stderr, 'CBUILDBOT Revision list found %s' % revisions | 379 # print >> sys.stderr, 'CBUILDBOT Revision list found %s' % revisions |
| 377 # revision_list = _ParseRevisionString(revisions, | 380 # revision_list = _ParseRevisionString(revisions, |
| 378 # _CreateRepoDictionary(buildroot, board)) | 381 # _CreateRepoDictionary(buildroot, board)) |
| 379 # _UprevFromRevisionList(buildroot, tracking_branch, revision_list, board) | 382 # _UprevFromRevisionList(buildroot, tracking_branch, revision_list, board, |
| 383 # overlays) |
| 380 #else: | 384 #else: |
| 381 Info('CBUILDBOT Revving all') | 385 Info('CBUILDBOT Revving all') |
| 382 _UprevAllPackages(buildroot, tracking_branch, board) | 386 _UprevAllPackages(buildroot, tracking_branch, board, overlays) |
| 383 | 387 |
| 384 | 388 |
| 385 def _UprevPush(buildroot, tracking_branch, board, overlays): | 389 def _UprevPush(buildroot, tracking_branch, board, overlays): |
| 386 """Pushes uprev changes to the main line.""" | 390 """Pushes uprev changes to the main line.""" |
| 387 cwd = os.path.join(buildroot, 'src', 'scripts') | 391 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 388 public_overlay = '%s/src/third_party/chromiumos-overlay' % buildroot | |
| 389 private_overlay = '%s/src/private-overlays/chromeos-overlay' % buildroot | |
| 390 if overlays == 'private': | |
| 391 overlays = [private_overlay] | |
| 392 elif overlays == 'public': | |
| 393 overlays = [public_overlay] | |
| 394 else: | |
| 395 overlays = [public_overlay, private_overlay] | |
| 396 RunCommand(['./cros_mark_as_stable', '--srcroot=..', | 392 RunCommand(['./cros_mark_as_stable', '--srcroot=..', |
| 397 '--board=%s' % board, | 393 '--board=%s' % board, |
| 398 '--overlays=%s' % " ".join(overlays), | 394 '--overlays=%s' % ':'.join(overlays), |
| 399 '--tracking_branch=%s' % tracking_branch, | 395 '--tracking_branch=%s' % tracking_branch, |
| 400 '--push_options=--bypass-hooks -f', 'push'], | 396 '--push_options=--bypass-hooks -f', 'push'], |
| 401 cwd=cwd) | 397 cwd=cwd) |
| 402 | 398 |
| 403 | 399 |
| 404 def _ArchiveTestResults(buildroot, board, archive_dir, test_results_dir): | 400 def _ArchiveTestResults(buildroot, board, archive_dir, test_results_dir): |
| 405 """Archives the test results into the www dir for later use. | 401 """Archives the test results into the www dir for later use. |
| 406 | 402 |
| 407 Takes the results from the test_results_dir and dumps them into the archive | 403 Takes the results from the test_results_dir and dumps them into the archive |
| 408 dir specified. This also archives the last qemu image. | 404 dir specified. This also archives the last qemu image. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 456 |
| 461 buildconfig = config[config_name] | 457 buildconfig = config[config_name] |
| 462 | 458 |
| 463 for key in default.iterkeys(): | 459 for key in default.iterkeys(): |
| 464 if not buildconfig.has_key(key): | 460 if not buildconfig.has_key(key): |
| 465 buildconfig[key] = default[key] | 461 buildconfig[key] = default[key] |
| 466 | 462 |
| 467 return buildconfig | 463 return buildconfig |
| 468 | 464 |
| 469 | 465 |
| 466 def _ResolveOverlays(buildroot, overlays): |
| 467 """Return the list of overlays to use for a given buildbot. |
| 468 |
| 469 Args: |
| 470 buildroot: The root directory where the build occurs. Must be an absolute |
| 471 path. |
| 472 overlays: A string describing which overlays you want. |
| 473 'private': Just the private overlay. |
| 474 'public': Just the public overlay. |
| 475 'both': Both the public and private overlays. |
| 476 """ |
| 477 public_overlay = '%s/src/third_party/chromiumos-overlay' % buildroot |
| 478 private_overlay = '%s/src/private-overlays/chromeos-overlay' % buildroot |
| 479 if overlays == 'private': |
| 480 paths = [private_overlay] |
| 481 elif overlays == 'public': |
| 482 paths = [public_overlay] |
| 483 elif overlays == 'both': |
| 484 paths = [public_overlay, private_overlay] |
| 485 else: |
| 486 Die('Incorrect overlay configuration: %s' % overlays) |
| 487 for path in paths: |
| 488 assert ':' not in path, 'Overlay must not contain colons: %s' % path |
| 489 if not os.path.isdir(path): |
| 490 Die('Missing overlay: %s' % path) |
| 491 return paths |
| 492 |
| 493 |
| 470 def main(): | 494 def main(): |
| 471 # Parse options | 495 # Parse options |
| 472 usage = "usage: %prog [options] cbuildbot_config" | 496 usage = "usage: %prog [options] cbuildbot_config" |
| 473 parser = optparse.OptionParser(usage=usage) | 497 parser = optparse.OptionParser(usage=usage) |
| 474 parser.add_option('-r', '--buildroot', | 498 parser.add_option('-r', '--buildroot', |
| 475 help='root directory where build occurs', default=".") | 499 help='root directory where build occurs', default=".") |
| 476 parser.add_option('-n', '--buildnumber', | 500 parser.add_option('-n', '--buildnumber', |
| 477 help='build number', type='int', default=0) | 501 help='build number', type='int', default=0) |
| 478 parser.add_option('-f', '--revisionfile', | 502 parser.add_option('-f', '--revisionfile', |
| 479 help='file where new revisions are stored') | 503 help='file where new revisions are stored') |
| 480 parser.add_option('--clobber', action='store_true', dest='clobber', | 504 parser.add_option('--clobber', action='store_true', dest='clobber', |
| 481 default=False, | 505 default=False, |
| 482 help='Clobbers an old checkout before syncing') | 506 help='Clobbers an old checkout before syncing') |
| 483 parser.add_option('--debug', action='store_true', dest='debug', | 507 parser.add_option('--debug', action='store_true', dest='debug', |
| 484 default=False, | 508 default=False, |
| 485 help='Override some options to run as a developer.') | 509 help='Override some options to run as a developer.') |
| 486 parser.add_option('-t', '--tracking-branch', dest='tracking_branch', | 510 parser.add_option('-t', '--tracking-branch', dest='tracking_branch', |
| 487 default='cros/master', help='Run the buildbot on a branch') | 511 default='cros/master', help='Run the buildbot on a branch') |
| 488 parser.add_option('-u', '--url', dest='url', | 512 parser.add_option('-u', '--url', dest='url', |
| 489 default='http://git.chromium.org/git/manifest', | 513 default='http://git.chromium.org/git/manifest', |
| 490 help='Run the buildbot on internal manifest') | 514 help='Run the buildbot on internal manifest') |
| 491 | 515 |
| 492 (options, args) = parser.parse_args() | 516 (options, args) = parser.parse_args() |
| 493 | 517 |
| 494 buildroot = options.buildroot | 518 buildroot = os.path.abspath(options.buildroot) |
| 495 revisionfile = options.revisionfile | 519 revisionfile = options.revisionfile |
| 496 tracking_branch = options.tracking_branch | 520 tracking_branch = options.tracking_branch |
| 497 | 521 |
| 498 if len(args) >= 1: | 522 if len(args) >= 1: |
| 499 buildconfig = _GetConfig(args[-1]) | 523 buildconfig = _GetConfig(args[-1]) |
| 500 else: | 524 else: |
| 501 Warning('Missing configuration description') | 525 Warning('Missing configuration description') |
| 502 parser.print_usage() | 526 parser.print_usage() |
| 503 sys.exit(1) | 527 sys.exit(1) |
| 504 | 528 |
| 529 # Calculate list of overlay directories. |
| 530 overlays = _ResolveOverlays(buildroot, buildconfig['overlays']) |
| 531 |
| 505 try: | 532 try: |
| 506 _PreFlightRinse(buildroot, buildconfig['board'], tracking_branch) | 533 _PreFlightRinse(buildroot, buildconfig['board'], tracking_branch, overlays) |
| 507 if options.clobber or not os.path.isdir(buildroot): | 534 if options.clobber or not os.path.isdir(buildroot): |
| 508 _FullCheckout(buildroot, tracking_branch, url=options.url) | 535 _FullCheckout(buildroot, tracking_branch, url=options.url) |
| 509 else: | 536 else: |
| 510 _IncrementalCheckout(buildroot) | 537 _IncrementalCheckout(buildroot) |
| 511 | 538 |
| 512 chroot_path = os.path.join(buildroot, 'chroot') | 539 chroot_path = os.path.join(buildroot, 'chroot') |
| 513 if not os.path.isdir(chroot_path): | 540 if not os.path.isdir(chroot_path): |
| 514 _MakeChroot(buildroot) | 541 _MakeChroot(buildroot) |
| 515 | 542 |
| 516 boardpath = os.path.join(chroot_path, 'build', buildconfig['board']) | 543 boardpath = os.path.join(chroot_path, 'build', buildconfig['board']) |
| 517 if not os.path.isdir(boardpath): | 544 if not os.path.isdir(boardpath): |
| 518 _SetupBoard(buildroot, board=buildconfig['board']) | 545 _SetupBoard(buildroot, board=buildconfig['board']) |
| 519 | 546 |
| 520 if buildconfig['uprev']: | 547 if buildconfig['uprev']: |
| 521 _UprevPackages(buildroot, tracking_branch, revisionfile, | 548 _UprevPackages(buildroot, tracking_branch, revisionfile, |
| 522 board=buildconfig['board']) | 549 buildconfig['board'], overlays) |
| 523 | 550 |
| 524 _EnableLocalAccount(buildroot) | 551 _EnableLocalAccount(buildroot) |
| 525 _Build(buildroot) | 552 _Build(buildroot) |
| 526 if buildconfig['unittests']: | 553 if buildconfig['unittests']: |
| 527 _RunUnitTests(buildroot) | 554 _RunUnitTests(buildroot) |
| 528 | 555 |
| 529 _BuildImage(buildroot) | 556 _BuildImage(buildroot) |
| 530 | 557 |
| 531 if buildconfig['smoke_bvt']: | 558 if buildconfig['smoke_bvt']: |
| 532 _BuildVMImageForTesting(buildroot) | 559 _BuildVMImageForTesting(buildroot) |
| 533 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber | 560 test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber |
| 534 try: | 561 try: |
| 535 _RunSmokeSuite(buildroot, test_results_dir) | 562 _RunSmokeSuite(buildroot, test_results_dir) |
| 536 finally: | 563 finally: |
| 537 _ArchiveTestResults(buildroot, buildconfig['board'], | 564 _ArchiveTestResults(buildroot, buildconfig['board'], |
| 538 archive_dir=options.buildnumber, | 565 archive_dir=options.buildnumber, |
| 539 test_results_dir=test_results_dir) | 566 test_results_dir=test_results_dir) |
| 540 | 567 |
| 541 if buildconfig['uprev']: | 568 if buildconfig['uprev']: |
| 542 # Don't push changes for developers. | 569 # Don't push changes for developers. |
| 543 if not options.debug: | 570 if not options.debug: |
| 544 if buildconfig['master']: | 571 if buildconfig['master']: |
| 545 # Master bot needs to check if the other slaves completed. | 572 # Master bot needs to check if the other slaves completed. |
| 546 if cbuildbot_comm.HaveSlavesCompleted(config): | 573 if cbuildbot_comm.HaveSlavesCompleted(config): |
| 547 _UprevPush(buildroot, tracking_branch, buildconfig['board'], | 574 _UprevPush(buildroot, tracking_branch, buildconfig['board'], |
| 548 buildconfig['overlays']) | 575 overlays) |
| 549 else: | 576 else: |
| 550 Die('CBUILDBOT - One of the slaves has failed!!!') | 577 Die('CBUILDBOT - One of the slaves has failed!!!') |
| 551 | 578 |
| 552 else: | 579 else: |
| 553 # Publish my status to the master if its expecting it. | 580 # Publish my status to the master if its expecting it. |
| 554 if buildconfig['important']: | 581 if buildconfig['important']: |
| 555 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) | 582 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) |
| 556 | 583 |
| 557 except: | 584 except: |
| 558 # Send failure to master bot. | 585 # Send failure to master bot. |
| 559 if not buildconfig['master'] and buildconfig['important']: | 586 if not buildconfig['master'] and buildconfig['important']: |
| 560 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 587 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
| 561 | 588 |
| 562 raise | 589 raise |
| 563 | 590 |
| 564 | 591 |
| 565 if __name__ == '__main__': | 592 if __name__ == '__main__': |
| 566 main() | 593 main() |
| OLD | NEW |