Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: bin/cbuildbot.py

Issue 3116029: Fix cbuildbot. Mistakenly used str.open instead of open (Closed) Base URL: ssh://git@chromiumos-git//crosutils.git
Patch Set: nits Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 13
14 from cbuildbot_config import config 14 from cbuildbot_config import config
15 15
16 _DEFAULT_RETRIES=3 16 _DEFAULT_RETRIES = 3
17 17
18 # Utility functions 18 # Utility functions
19 19
20 def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None, 20 def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
21 exit_code=False, redirect_stdout=False, redirect_stderr=False, 21 exit_code=False, redirect_stdout=False, redirect_stderr=False,
22 cwd=None, input=None): 22 cwd=None, input=None):
23 # Print out the command before running. 23 # Print out the command before running.
24 if print_cmd: 24 if print_cmd:
25 print >> sys.stderr, "CBUILDBOT -- RunCommand:", ' '.join(cmd) 25 print >> sys.stderr, "CBUILDBOT -- RunCommand:", ' '.join(cmd)
26 if redirect_stdout: 26 if redirect_stdout:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if rw_checkout: 61 if rw_checkout:
62 # Always re-run in case of new git repos or repo sync 62 # Always re-run in case of new git repos or repo sync
63 # failed in a previous run because of a forced Stop Build. 63 # failed in a previous run because of a forced Stop Build.
64 RunCommand(['repo', 'forall', '-c', 'git', 'config', 64 RunCommand(['repo', 'forall', '-c', 'git', 'config',
65 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', 65 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof',
66 'http://src.chromium.org/git'], cwd=buildroot) 66 'http://src.chromium.org/git'], cwd=buildroot)
67 retries = 0 67 retries = 0
68 except: 68 except:
69 retries -= 1 69 retries -= 1
70 if retries > 0: 70 if retries > 0:
71 print >>sys.stderr, 'CBUILDBOT -- Repo Sync Failed, retrying' 71 print >> sys.stderr, 'CBUILDBOT -- Repo Sync Failed, retrying'
72 else: 72 else:
73 print >>sys.stderr, 'CBUILDBOT -- Retries exhausted' 73 print >> sys.stderr, 'CBUILDBOT -- Retries exhausted'
74 raise 74 raise
75 75
76 # Main functions 76 # Main functions
77 77
78 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES): 78 def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES):
79 RunCommand(['sudo', 'rm', '-rf', buildroot]) 79 RunCommand(['sudo', 'rm', '-rf', buildroot])
80 MakeDir(buildroot, parents=True) 80 MakeDir(buildroot, parents=True)
81 RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'], 81 RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'],
82 cwd=buildroot, input='\n\ny\n') 82 cwd=buildroot, input='\n\ny\n')
83 RepoSync(buildroot, rw_checkout, retries) 83 RepoSync(buildroot, rw_checkout, retries)
(...skipping 17 matching lines...) Expand all
101 101
102 def _UprevAllPackages(buildroot): 102 def _UprevAllPackages(buildroot):
103 cwd = os.path.join(buildroot, 'src', 'scripts') 103 cwd = os.path.join(buildroot, 'src', 'scripts')
104 RunCommand(['./enter_chroot.sh', '--', './cros_mark_all_as_stable', 104 RunCommand(['./enter_chroot.sh', '--', './cros_mark_all_as_stable',
105 '--tracking_branch="cros/master"'], 105 '--tracking_branch="cros/master"'],
106 cwd=cwd) 106 cwd=cwd)
107 107
108 def _UprevPackages(buildroot, revisionfile): 108 def _UprevPackages(buildroot, revisionfile):
109 revisions = None 109 revisions = None
110 if (revisionfile): 110 if (revisionfile):
111 rev_file = revisionfile.open(revisionfile) 111 try:
112 revisions = rev_file.read() 112 rev_file = open(revisionfile)
113 rev_file.close() 113 revisions = rev_file.read()
114 rev_file.close()
115 except:
116 print >> sys.stderr, 'Error reading %s' % revisionfile
117 revisions = None
114 118
115 # Note: Revisions == "None" indicates a Force Build. 119 # Note: Revisions == "None" indicates a Force Build.
116 if revisions and revisions != 'None': 120 if revisions and revisions != 'None':
117 print 'CBUILDBOT - Revision list found %s' % revisions 121 print 'CBUILDBOT - Revision list found %s' % revisions
118 print 'Revision list not yet propagating to build, marking all instead' 122 print 'Revision list not yet propagating to build, marking all instead'
119 123
120 _UprevAllPackages(buildroot) 124 _UprevAllPackages(buildroot)
121 125
122 def _UprevCleanup(buildroot): 126 def _UprevCleanup(buildroot):
123 cwd = os.path.join(buildroot, 'src', 'scripts') 127 cwd = os.path.join(buildroot, 'src', 'scripts')
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 _UprevPush(buildroot) 189 _UprevPush(buildroot)
186 _UprevCleanup(buildroot) 190 _UprevCleanup(buildroot)
187 except: 191 except:
188 # something went wrong, cleanup (being paranoid) for next build 192 # something went wrong, cleanup (being paranoid) for next build
189 if clobber: 193 if clobber:
190 RunCommand(['sudo', 'rm', '-rf', buildroot], print_cmd=False) 194 RunCommand(['sudo', 'rm', '-rf', buildroot], print_cmd=False)
191 raise 195 raise
192 196
193 if __name__ == '__main__': 197 if __name__ == '__main__':
194 main() 198 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698