| 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 re | 10 import re |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 def _GetAllGitRepos(buildroot, debug=False): | 77 def _GetAllGitRepos(buildroot, debug=False): |
| 78 """Returns a list of tuples containing [git_repo, src_path].""" | 78 """Returns a list of tuples containing [git_repo, src_path].""" |
| 79 manifest_tuples = [] | 79 manifest_tuples = [] |
| 80 # Gets all the git repos from a full repo manifest. | 80 # Gets all the git repos from a full repo manifest. |
| 81 repo_cmd = "repo manifest -o -".split() | 81 repo_cmd = "repo manifest -o -".split() |
| 82 output = RunCommand(repo_cmd, cwd=buildroot, redirect_stdout=True, | 82 output = RunCommand(repo_cmd, cwd=buildroot, redirect_stdout=True, |
| 83 redirect_stderr=True, print_cmd=debug) | 83 redirect_stderr=True, print_cmd=debug) |
| 84 | 84 |
| 85 # Extract all lines containg a project. | 85 # Extract all lines containg a project. |
| 86 extract_cmd = ["grep", "project name="] | 86 extract_cmd = ['grep', 'project name='] |
| 87 output = RunCommand(extract_cmd, cwd=buildroot, input=output, | 87 output = RunCommand(extract_cmd, cwd=buildroot, input=output, |
| 88 redirect_stdout=True, print_cmd=debug) | 88 redirect_stdout=True, print_cmd=debug) |
| 89 # Parse line using re to get tuple. | 89 # Parse line using re to get tuple. |
| 90 result_array = re.findall('.+name=\"([\w-]+)\".+path=\"(\S+)".+', output) | 90 result_array = re.findall('.+name=\"([\w-]+)\".+path=\"(\S+)".+', output) |
| 91 | 91 |
| 92 # Create the array. | 92 # Create the array. |
| 93 for result in result_array: | 93 for result in result_array: |
| 94 if len(result) != 2: | 94 if len(result) != 2: |
| 95 Warning('Found incorrect xml object %s' % result) | 95 Warning('Found incorrect xml object %s' % result) |
| 96 else: | 96 else: |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 cwd = os.path.join(buildroot, 'src', 'scripts') | 282 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 283 RunCommand(['./build_image', '--replace'], cwd=cwd, enter_chroot=True) | 283 RunCommand(['./build_image', '--replace'], cwd=cwd, enter_chroot=True) |
| 284 | 284 |
| 285 | 285 |
| 286 def _BuildVMImageForTesting(buildroot): | 286 def _BuildVMImageForTesting(buildroot): |
| 287 (vdisk_size, statefulfs_size) = _GetVMConstants(buildroot) | 287 (vdisk_size, statefulfs_size) = _GetVMConstants(buildroot) |
| 288 cwd = os.path.join(buildroot, 'src', 'scripts') | 288 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 289 RunCommand(['./image_to_vm.sh', | 289 RunCommand(['./image_to_vm.sh', |
| 290 '--test_image', | 290 '--test_image', |
| 291 '--full', | 291 '--full', |
| 292 '--vdisk_size %s' % vdisk_size, | 292 '--vdisk_size=%s' % vdisk_size, |
| 293 '--statefulfs_size %s' % statefulfs_size, | 293 '--statefulfs_size=%s' % statefulfs_size, |
| 294 ], cwd=cwd, enter_chroot=True) | 294 ], cwd=cwd, enter_chroot=True) |
| 295 | 295 |
| 296 | 296 |
| 297 def _RunUnitTests(buildroot): | 297 def _RunUnitTests(buildroot): |
| 298 cwd = os.path.join(buildroot, 'src', 'scripts') | 298 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 299 RunCommand(['./cros_run_unit_tests'], cwd=cwd, enter_chroot=True) | 299 RunCommand(['./cros_run_unit_tests'], cwd=cwd, enter_chroot=True) |
| 300 | 300 |
| 301 | 301 |
| 302 def _RunSmokeSuite(buildroot): | 302 def _RunSmokeSuite(buildroot): |
| 303 cwd = os.path.join(buildroot, 'src', 'scripts') | 303 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 304 RunCommand(['bin/cros_run_vm_test', | 304 RunCommand(['bin/cros_run_vm_test', |
| 305 '--no_graphics', | 305 '--no_graphics', |
| 306 '--test_case', | 306 '--test_case=suite_Smoke', |
| 307 'suite_Smoke', | |
| 308 ], cwd=cwd, error_ok=False) | 307 ], cwd=cwd, error_ok=False) |
| 309 | 308 |
| 310 | 309 |
| 311 def _UprevPackages(buildroot, revisionfile, board): | 310 def _UprevPackages(buildroot, revisionfile, board): |
| 312 """Uprevs a package based on given revisionfile. | 311 """Uprevs a package based on given revisionfile. |
| 313 | 312 |
| 314 If revisionfile is set to None or does not resolve to an actual file, this | 313 If revisionfile is set to None or does not resolve to an actual file, this |
| 315 function will uprev all packages. | 314 function will uprev all packages. |
| 316 | 315 |
| 317 Keyword arguments: | 316 Keyword arguments: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 RunCommand(['./cros_mark_as_stable', '--srcroot=..', | 348 RunCommand(['./cros_mark_as_stable', '--srcroot=..', |
| 350 '--tracking_branch="cros/master"', 'clean'], | 349 '--tracking_branch="cros/master"', 'clean'], |
| 351 cwd=cwd, error_ok=error_ok) | 350 cwd=cwd, error_ok=error_ok) |
| 352 | 351 |
| 353 | 352 |
| 354 def _UprevPush(buildroot): | 353 def _UprevPush(buildroot): |
| 355 """Pushes uprev changes to the main line.""" | 354 """Pushes uprev changes to the main line.""" |
| 356 cwd = os.path.join(buildroot, 'src', 'scripts') | 355 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 357 RunCommand(['./cros_mark_as_stable', '--srcroot=..', | 356 RunCommand(['./cros_mark_as_stable', '--srcroot=..', |
| 358 '--tracking_branch="cros/master"', | 357 '--tracking_branch="cros/master"', |
| 359 '--push_options', '--bypass-hooks -f', 'push'], | 358 '--push_options="--bypass-hooks -f"', 'push'], |
| 360 cwd=cwd) | 359 cwd=cwd) |
| 361 | 360 |
| 362 | 361 |
| 363 def _GetConfig(config_name): | 362 def _GetConfig(config_name): |
| 364 """Gets the configuration for the build""" | 363 """Gets the configuration for the build""" |
| 365 default = config['default'] | 364 default = config['default'] |
| 366 buildconfig = {} | 365 buildconfig = {} |
| 367 if not config.has_key(config_name): | 366 if not config.has_key(config_name): |
| 368 Warning('Non-existent configuration specified.') | 367 Warning('Non-existent configuration specified.') |
| 369 Warning('Please specify one of:') | 368 Warning('Please specify one of:') |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 except: | 463 except: |
| 465 # Send failure to master bot. | 464 # Send failure to master bot. |
| 466 if not buildconfig['master'] and buildconfig['important']: | 465 if not buildconfig['master'] and buildconfig['important']: |
| 467 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 466 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
| 468 | 467 |
| 469 raise | 468 raise |
| 470 | 469 |
| 471 | 470 |
| 472 if __name__ == '__main__': | 471 if __name__ == '__main__': |
| 473 main() | 472 main() |
| OLD | NEW |