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 import errno | 7 import errno |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 def MakeDir(path, parents=False): | 47 def MakeDir(path, parents=False): |
48 try: | 48 try: |
49 os.makedirs(path) | 49 os.makedirs(path) |
50 except OSError,e: | 50 except OSError,e: |
51 if e.errno == errno.EEXIST and parents: | 51 if e.errno == errno.EEXIST and parents: |
52 pass | 52 pass |
53 else: | 53 else: |
54 raise | 54 raise |
55 | 55 |
56 def RepoSync(buildroot, retries=_DEFAULT_RETRIES): | 56 def RepoSync(buildroot, rw_checkout, retries=_DEFAULT_RETRIES): |
57 while retries > 0: | 57 while retries > 0: |
58 try: | 58 try: |
59 RunCommand(['repo', 'sync'], cwd=buildroot) | 59 RunCommand(['repo', 'sync'], cwd=buildroot) |
60 if rw_checkout: | |
61 # Always re-run in case of new git repos or repo sync | |
62 # failed in a previous run because of a forced Stop Build. | |
63 RunCommand(['repo', 'forall', '-c', 'git', 'config', | |
64 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', | |
65 'http://src.chromium.org/git'], cwd=buildroot) | |
Mandeep Singh Baines
2010/08/19 22:57:07
What this is doing is telling git to use ssh inste
| |
60 retries = 0 | 66 retries = 0 |
61 except: | 67 except: |
62 retries -= 1 | 68 retries -= 1 |
63 if retries > 0: | 69 if retries > 0: |
64 print >>sys.stderr, 'CBUILDBOT -- Repo Sync Failed, retrying' | 70 print >>sys.stderr, 'CBUILDBOT -- Repo Sync Failed, retrying' |
65 else: | 71 else: |
66 print >>sys.stderr, 'CBUILDBOT -- Retries exhausted' | 72 print >>sys.stderr, 'CBUILDBOT -- Retries exhausted' |
67 raise | 73 raise |
68 | 74 |
69 # Main functions | 75 # Main functions |
70 | 76 |
71 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES): | 77 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES): |
72 RunCommand(['sudo', 'rm', '-rf', buildroot]) | 78 RunCommand(['sudo', 'rm', '-rf', buildroot]) |
73 MakeDir(buildroot, parents=True) | 79 MakeDir(buildroot, parents=True) |
74 RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'], | 80 RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'], |
75 cwd=buildroot, input='\n\ny\n') | 81 cwd=buildroot, input='\n\ny\n') |
76 RepoSync(buildroot, retries) | 82 RepoSync(buildroot, rw_checkout, retries) |
77 if rw_checkout: | |
78 RunCommand(['repo', 'forall', '-c', 'git', 'config', | |
79 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', | |
80 'http://src.chromium.org/git'], cwd=buildroot) | |
81 | 83 |
82 def _IncrementalCheckout(buildroot, retries=_DEFAULT_RETRIES): | 84 def _IncrementalCheckout(buildroot, rw_checkout=True, |
83 RepoSync(buildroot, retries) | 85 retries=_DEFAULT_RETRIES): |
84 # Always re-run in case of new git repos or repo sync | 86 RepoSync(buildroot, rw_checkout, retries) |
85 # failed in a previous run because of a forced Stop Build. | |
86 RunCommand(['repo', 'forall', '-c', 'git', 'config', | |
87 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', | |
88 'http://src.chromium.org/git'], cwd=buildroot) | |
89 | 87 |
90 def _MakeChroot(buildroot): | 88 def _MakeChroot(buildroot): |
91 cwd = os.path.join(buildroot, 'src', 'scripts') | 89 cwd = os.path.join(buildroot, 'src', 'scripts') |
92 RunCommand(['./make_chroot', '--fast'], cwd=cwd) | 90 RunCommand(['./make_chroot', '--fast'], cwd=cwd) |
93 | 91 |
94 def _SetupBoard(buildroot, board='x86-generic'): | 92 def _SetupBoard(buildroot, board='x86-generic'): |
95 cwd = os.path.join(buildroot, 'src', 'scripts') | 93 cwd = os.path.join(buildroot, 'src', 'scripts') |
96 RunCommand(['./setup_board', '--fast', '--default', '--board=%s' % board], | 94 RunCommand(['./setup_board', '--fast', '--default', '--board=%s' % board], |
97 cwd=cwd) | 95 cwd=cwd) |
98 | 96 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 if buildconfig['uprev']: | 161 if buildconfig['uprev']: |
164 _UprevPush(buildroot) | 162 _UprevPush(buildroot) |
165 _UprevCleanup(buildroot) | 163 _UprevCleanup(buildroot) |
166 except: | 164 except: |
167 # something went wrong, cleanup (being paranoid) for next build | 165 # something went wrong, cleanup (being paranoid) for next build |
168 RunCommand(['sudo', 'rm', '-rf', buildroot]) | 166 RunCommand(['sudo', 'rm', '-rf', buildroot]) |
169 raise | 167 raise |
170 | 168 |
171 if __name__ == '__main__': | 169 if __name__ == '__main__': |
172 main() | 170 main() |
OLD | NEW |