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