| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 Info('No packages found to uprev') | 187 Info('No packages found to uprev') |
| 188 return | 188 return |
| 189 | 189 |
| 190 package_str = '' | 190 package_str = '' |
| 191 for package, revision in revision_list: | 191 for package, revision in revision_list: |
| 192 package_str += package + ' ' | 192 package_str += package + ' ' |
| 193 | 193 |
| 194 package_str = package_str.strip() | 194 package_str = package_str.strip() |
| 195 | 195 |
| 196 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. |
| 197 RunCommand(['./cros_mark_as_stable', | 199 RunCommand(['./cros_mark_as_stable', |
| 198 '--board=%s' % board, | 200 '--board=%s' % board, |
| 199 '--tracking_branch="%s"' % tracking_branch, | 201 '--tracking_branch="%s"' % tracking_branch, |
| 200 '--packages="%s"' % package_str, | 202 '--packages="%s"' % package_str, |
| 201 'commit'], | 203 'commit'], |
| 202 cwd=cwd, enter_chroot=True) | 204 cwd=cwd, enter_chroot=True) |
| 203 | 205 |
| 204 | 206 |
| 205 def _UprevAllPackages(buildroot, tracking_branch, board): | 207 def _UprevAllPackages(buildroot, tracking_branch, board): |
| 206 """Uprevs all packages that have been updated since last uprev.""" | 208 """Uprevs all packages that have been updated since last uprev.""" |
| 207 cwd = os.path.join(buildroot, 'src', 'scripts') | 209 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 210 # TODO(davidjames): --foo="bar baz" only works here because we're using |
| 211 # enter_chroot. |
| 208 RunCommand(['./cros_mark_as_stable', '--all', | 212 RunCommand(['./cros_mark_as_stable', '--all', |
| 209 '--board=%s' % board, | 213 '--board=%s' % board, |
| 210 '--tracking_branch="%s"' % tracking_branch, 'commit'], | 214 '--tracking_branch="%s"' % tracking_branch, 'commit'], |
| 211 cwd=cwd, enter_chroot=True) | 215 cwd=cwd, enter_chroot=True) |
| 212 | 216 |
| 213 | 217 |
| 214 def _GetVMConstants(buildroot): | 218 def _GetVMConstants(buildroot): |
| 215 """Returns minimum (vdisk_size, statefulfs_size) recommended for VM's.""" | 219 """Returns minimum (vdisk_size, statefulfs_size) recommended for VM's.""" |
| 216 cwd = os.path.join(buildroot, 'src', 'scripts', 'lib') | 220 cwd = os.path.join(buildroot, 'src', 'scripts', 'lib') |
| 217 source_cmd = 'source %s/cros_vm_constants.sh' % cwd | 221 source_cmd = 'source %s/cros_vm_constants.sh' % cwd |
| 218 vdisk_size = RunCommand([ | 222 vdisk_size = RunCommand([ |
| 219 '/bin/bash', '-c', '%s && echo $MIN_VDISK_SIZE_FULL' % source_cmd], | 223 '/bin/bash', '-c', '%s && echo $MIN_VDISK_SIZE_FULL' % source_cmd], |
| 220 redirect_stdout=True) | 224 redirect_stdout=True) |
| 221 statefulfs_size = RunCommand([ | 225 statefulfs_size = RunCommand([ |
| 222 '/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], |
| 223 redirect_stdout=True) | 227 redirect_stdout=True) |
| 224 return (vdisk_size.strip(), statefulfs_size.strip()) | 228 return (vdisk_size.strip(), statefulfs_size.strip()) |
| 225 | 229 |
| 226 | 230 |
| 227 def _GitCleanup(buildroot, board, tracking_branch): | 231 def _GitCleanup(buildroot, board, tracking_branch): |
| 228 """Clean up git branch after previous uprev attempt.""" | 232 """Clean up git branch after previous uprev attempt.""" |
| 229 cwd = os.path.join(buildroot, 'src', 'scripts') | 233 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 230 if os.path.exists(cwd): | 234 if os.path.exists(cwd): |
| 231 RunCommand(['./cros_mark_as_stable', '--srcroot=..', | 235 RunCommand(['./cros_mark_as_stable', '--srcroot=..', |
| 232 '--board=%s' % board, | 236 '--board=%s' % board, |
| 233 '--tracking_branch="%s"' % tracking_branch, 'clean'], | 237 '--tracking_branch=%s' % tracking_branch, 'clean'], |
| 234 cwd=cwd, error_ok=True) | 238 cwd=cwd, error_ok=True) |
| 235 | 239 |
| 236 | 240 |
| 237 def _CleanUpMountPoints(buildroot): | 241 def _CleanUpMountPoints(buildroot): |
| 238 """Cleans up any stale mount points from previous runs.""" | 242 """Cleans up any stale mount points from previous runs.""" |
| 239 mount_output = RunCommand(['mount'], redirect_stdout=True) | 243 mount_output = RunCommand(['mount'], redirect_stdout=True) |
| 240 mount_pts_in_buildroot = RunCommand(['grep', buildroot], input=mount_output, | 244 mount_pts_in_buildroot = RunCommand(['grep', buildroot], input=mount_output, |
| 241 redirect_stdout=True, error_ok=True) | 245 redirect_stdout=True, error_ok=True) |
| 242 | 246 |
| 243 for mount_pt_str in mount_pts_in_buildroot.splitlines(): | 247 for mount_pt_str in mount_pts_in_buildroot.splitlines(): |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 public_overlay = '%s/src/third_party/chromiumos-overlay' % buildroot | 388 public_overlay = '%s/src/third_party/chromiumos-overlay' % buildroot |
| 385 private_overlay = '%s/src/private-overlays/chromeos-overlay' % buildroot | 389 private_overlay = '%s/src/private-overlays/chromeos-overlay' % buildroot |
| 386 if overlays == 'private': | 390 if overlays == 'private': |
| 387 overlays = [private_overlay] | 391 overlays = [private_overlay] |
| 388 elif overlays == 'public': | 392 elif overlays == 'public': |
| 389 overlays = [public_overlay] | 393 overlays = [public_overlay] |
| 390 else: | 394 else: |
| 391 overlays = [public_overlay, private_overlay] | 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. |
| 405 | 409 |
| 406 board: Board to find the qemu image. | 410 board: Board to find the qemu image. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 except: | 557 except: |
| 554 # Send failure to master bot. | 558 # Send failure to master bot. |
| 555 if not buildconfig['master'] and buildconfig['important']: | 559 if not buildconfig['master'] and buildconfig['important']: |
| 556 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 560 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
| 557 | 561 |
| 558 raise | 562 raise |
| 559 | 563 |
| 560 | 564 |
| 561 if __name__ == '__main__': | 565 if __name__ == '__main__': |
| 562 main() | 566 main() |
| OLD | NEW |