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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 | 41 |
42 def RepoSync(buildroot, rw_checkout=False, retries=_DEFAULT_RETRIES): | 42 def RepoSync(buildroot, rw_checkout=False, retries=_DEFAULT_RETRIES): |
43 """Uses repo to checkout the source code. | 43 """Uses repo to checkout the source code. |
44 | 44 |
45 Keyword arguments: | 45 Keyword arguments: |
46 rw_checkout -- Reconfigure repo after sync'ing to read-write. | 46 rw_checkout -- Reconfigure repo after sync'ing to read-write. |
47 retries -- Number of retries to try before failing on the sync. | 47 retries -- Number of retries to try before failing on the sync. |
48 | 48 |
49 """ | 49 """ |
50 # Get the number of processors to use with repo sync. | |
51 num_procs = int(RunCommand('grep -c processor /proc/cpuinfo'.split(), | |
52 print_cmd=False, redirect_stdout=True)) | |
53 | |
54 while retries > 0: | 50 while retries > 0: |
55 try: | 51 try: |
56 RunCommand(['repo', 'sync', '--jobs=%d' % (num_procs)], cwd=buildroot) | 52 # The --trace option ensures that repo shows the output from git. This |
| 53 # is needed so that the buildbot can kill us if git is not making |
| 54 # progress. |
| 55 RunCommand(['repo', '--trace', 'sync'], cwd=buildroot) |
57 if rw_checkout: | 56 if rw_checkout: |
58 # Always re-run in case of new git repos or repo sync | 57 # Always re-run in case of new git repos or repo sync |
59 # failed in a previous run because of a forced Stop Build. | 58 # failed in a previous run because of a forced Stop Build. |
60 RunCommand(['repo', 'forall', '-c', 'git', 'config', | 59 RunCommand(['repo', 'forall', '-c', 'git', 'config', |
61 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', | 60 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', |
62 'http://git.chromium.org/git'], cwd=buildroot) | 61 'http://git.chromium.org/git'], cwd=buildroot) |
63 | 62 |
64 retries = 0 | 63 retries = 0 |
65 except: | 64 except: |
66 retries -= 1 | 65 retries -= 1 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 except: | 399 except: |
401 # Send failure to master bot. | 400 # Send failure to master bot. |
402 if not buildconfig['master'] and buildconfig['important']: | 401 if not buildconfig['master'] and buildconfig['important']: |
403 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) | 402 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) |
404 | 403 |
405 raise | 404 raise |
406 | 405 |
407 | 406 |
408 if __name__ == '__main__': | 407 if __name__ == '__main__': |
409 main() | 408 main() |
OLD | NEW |