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

Side by Side Diff: bin/cbuildbot.py

Issue 3137006: Add some information to cbuildbot output. (Closed) Base URL: http://src.chromium.org/git/crosutils.git
Patch Set: Add copyrights 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 | bin/cbuildbot_config.py » ('j') | 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.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
3 import errno 7 import errno
4 import optparse 8 import optparse
5 import os 9 import os
6 import shutil 10 import shutil
7 import subprocess 11 import subprocess
12 import sys
8 13
9 from cbuildbot_config import config 14 from cbuildbot_config import config
10 15
11 # Utility functions 16 # Utility functions
12 17
13 def RunCommand(cmd, error_ok=False, error_message=None, exit_code=False, 18 def RunCommand(cmd, error_ok=False, error_message=None, exit_code=False,
14 redirect_stdout=False, redirect_stderr=False, cwd=None, 19 redirect_stdout=False, redirect_stderr=False, cwd=None,
15 input=None): 20 input=None):
16 # Useful for debugging: 21 # Print out the command before running.
17 # print >>sys.stderr, "RunCommand:", ' '.join(cmd) 22 print >>sys.stderr, "CBUILDBOT -- RunCommand:", ' '.join(cmd)
18 if redirect_stdout: 23 if redirect_stdout:
19 stdout = subprocess.PIPE 24 stdout = subprocess.PIPE
20 else: 25 else:
21 stdout = None 26 stdout = None
22 if redirect_stderr: 27 if redirect_stderr:
23 stderr = subprocess.PIPE 28 stderr = subprocess.PIPE
24 else: 29 else:
25 stderr = None 30 stderr = None
26 if input: 31 if input:
27 stdin = subprocess.PIPE 32 stdin = subprocess.PIPE
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 buildconfig = {} 102 buildconfig = {}
98 if config.has_key(config_name): 103 if config.has_key(config_name):
99 buildconfig = config[config_name] 104 buildconfig = config[config_name]
100 for key in default.iterkeys(): 105 for key in default.iterkeys():
101 if not buildconfig.has_key(key): 106 if not buildconfig.has_key(key):
102 buildconfig[key] = default[key] 107 buildconfig[key] = default[key]
103 return buildconfig 108 return buildconfig
104 109
105 def main(): 110 def main():
106 # Parse options 111 # Parse options
107 parser = optparse.OptionParser() 112 usage = "usage: %prog [options] cbuildbot_config"
113 parser = optparse.OptionParser(usage=usage)
108 parser.add_option('-r', '--buildroot', 114 parser.add_option('-r', '--buildroot',
109 help='root directory where build occurs', default=".") 115 help='root directory where build occurs', default=".")
110 parser.add_option('-n', '--buildnumber', 116 parser.add_option('-n', '--buildnumber',
111 help='build number', type='int', default=0) 117 help='build number', type='int', default=0)
112 (options, args) = parser.parse_args() 118 (options, args) = parser.parse_args()
113 119
114 buildroot = options.buildroot 120 buildroot = options.buildroot
115 buildconfig = _GetConfig(args[0]) 121 if len(args) == 1:
116 122 buildconfig = _GetConfig(args[0])
123 else:
124 print >>sys.stderr, "Missing configuration description"
125 parser.print_usage()
126 sys.exit(1)
117 try: 127 try:
118 if not os.path.isdir(buildroot): 128 if not os.path.isdir(buildroot):
119 _FullCheckout(buildroot) 129 _FullCheckout(buildroot)
120 else: 130 else:
121 _IncrementalCheckout(buildroot) 131 _IncrementalCheckout(buildroot)
122 chroot_path = os.path.join(buildroot, 'chroot') 132 chroot_path = os.path.join(buildroot, 'chroot')
123 if not os.path.isdir(chroot_path): 133 if not os.path.isdir(chroot_path):
124 _MakeChroot(buildroot) 134 _MakeChroot(buildroot)
125 boardpath = os.path.join(chroot_path, 'build', buildconfig['board']) 135 boardpath = os.path.join(chroot_path, 'build', buildconfig['board'])
126 if not os.path.isdir(boardpath): 136 if not os.path.isdir(boardpath):
127 _SetupBoard(buildroot, board=buildconfig['board']) 137 _SetupBoard(buildroot, board=buildconfig['board'])
128 if buildconfig['uprev']: 138 if buildconfig['uprev']:
129 _UprevPackages(buildroot) 139 _UprevPackages(buildroot)
130 _Build(buildroot) 140 _Build(buildroot)
131 if buildconfig['uprev']: 141 if buildconfig['uprev']:
132 _UprevPush(buildroot) 142 _UprevPush(buildroot)
133 _UprevCleanup(buildroot) 143 _UprevCleanup(buildroot)
134 except: 144 except:
135 # something went wrong, cleanup (being paranoid) for next build 145 # something went wrong, cleanup (being paranoid) for next build
136 RunCommand(['sudo', 'rm', '-rf', buildroot]) 146 RunCommand(['sudo', 'rm', '-rf', buildroot])
137 raise 147 raise
138 148
139 if __name__ == '__main__': 149 if __name__ == '__main__':
140 main() 150 main()
OLDNEW
« no previous file with comments | « no previous file | bin/cbuildbot_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698