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

Side by Side Diff: buildbot/cbuildbot.py

Issue 6691047: Merge MVP script into cbuildbot. (Closed) Base URL: http://git.chromium.org/git/chromite.git@master
Patch Set: Fix review problems. Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | buildbot/cbuildbot_commands.py » ('j') | buildbot/cbuildbot_commands.py » ('J')
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) 2011 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2011 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 """Main builder code for Chromium OS. 7 """Main builder code for Chromium OS.
8 8
9 Used by Chromium OS buildbot configuration for all Chromium OS builds including 9 Used by Chromium OS buildbot configuration for all Chromium OS builds including
10 full and pre-flight-queue builds. 10 full and pre-flight-queue builds.
11 """ 11 """
12 12
13 import errno 13 import errno
14 import optparse 14 import optparse
15 import os 15 import os
16 import sys 16 import sys
17 import traceback 17 import traceback
18 18
19 if __name__ == '__main__': 19 if __name__ == '__main__':
20 import constants 20 import constants
21 sys.path.append(constants.SOURCE_ROOT) 21 sys.path.append(constants.SOURCE_ROOT)
22 22
23 import chromite.buildbot.cbuildbot_comm as cbuildbot_comm 23 import chromite.buildbot.cbuildbot_comm as cbuildbot_comm
24 import chromite.buildbot.cbuildbot_config as cbuildbot_config 24 import chromite.buildbot.cbuildbot_config as cbuildbot_config
25 import chromite.buildbot.cbuildbot_stages as stages 25 import chromite.buildbot.cbuildbot_stages as stages
26 import chromite.lib.cros_build_lib as cros_lib 26 import chromite.lib.cros_build_lib as cros_lib
27 27
28 28
29 def _GetConfig(config_name): 29 def _GetConfig(config_name, options):
30 """Gets the configuration for the build""" 30 """Gets the configuration for the build"""
31 build_config = {} 31 build_config = {}
32 if not cbuildbot_config.config.has_key(config_name): 32 if not cbuildbot_config.config.has_key(config_name):
33 Warning('Non-existent configuration specified.') 33 Warning('Non-existent configuration specified.')
34 Warning('Please specify one of:') 34 Warning('Please specify one of:')
35 config_names = config.keys() 35 config_names = config.keys()
36 config_names.sort() 36 config_names.sort()
37 for name in config_names: 37 for name in config_names:
38 Warning(' %s' % name) 38 Warning(' %s' % name)
39 sys.exit(1) 39 sys.exit(1)
40 40
41 return cbuildbot_config.config[config_name] 41 result = cbuildbot_config.config[config_name]
42
43 # Use the config specific url, if not given on command line.
44 if options.url:
45 result['git_url'] = options.url
46
47 return result
42 48
43 49
44 def RunBuildStages(bot_id, options, build_config): 50 def RunBuildStages(bot_id, options, build_config):
45 """Run the requested build stages.""" 51 """Run the requested build stages."""
46 try: 52 try:
47 if options.sync: 53 if options.sync:
48 stages.SyncStage(bot_id, options, build_config).Run() 54 if build_config['manifest_version']:
55 stages.ManifestVersionedSyncStage(bot_id, options, build_config).Run()
56 else:
57 stages.SyncStage(bot_id, options, build_config).Run()
49 58
50 if options.build: 59 if options.build:
51 stages.BuildBoardStage(bot_id, options, build_config).Run() 60 stages.BuildBoardStage(bot_id, options, build_config).Run()
52 61
53 if options.uprev: 62 if options.uprev:
54 stages.UprevStage(bot_id, options, build_config).Run() 63 stages.UprevStage(bot_id, options, build_config).Run()
55 64
56 if options.build: 65 if options.build:
57 stages.BuildTargetStage(bot_id, options, build_config).Run() 66 stages.BuildTargetStage(bot_id, options, build_config).Run()
58 67
(...skipping 15 matching lines...) Expand all
74 83
75 elif build_config['important']: 84 elif build_config['important']:
76 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE) 85 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_COMPLETE)
77 86
78 finally: 87 finally:
79 if options.archive: 88 if options.archive:
80 stages.ArchiveStage(bot_id, options, build_config).Run() 89 stages.ArchiveStage(bot_id, options, build_config).Run()
81 cros_lib.Info('BUILD ARTIFACTS FOR THIS BUILD CAN BE FOUND AT:') 90 cros_lib.Info('BUILD ARTIFACTS FOR THIS BUILD CAN BE FOUND AT:')
82 cros_lib.Info(stages.BuilderStage.archive_url) 91 cros_lib.Info(stages.BuilderStage.archive_url)
83 92
93 if options.sync and build_config['manifest_version']:
94 stages.ManifestVersionedSyncCompletionStage(bot_id,
95 options,
96 build_config,
97 success=True).Run()
98
84 except: 99 except:
85 # Send failure to master. 100 # Send failure to master.
86 if not build_config['master'] and build_config['important']: 101 if not build_config['master'] and build_config['important']:
87 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED) 102 cbuildbot_comm.PublishStatus(cbuildbot_comm.STATUS_BUILD_FAILED)
88 103
104 if options.sync and build_config['manifest_version']:
105 stages.ManifestVersionedSyncCompletionStage(bot_id,
106 options,
107 build_config,
108 success=False).Run()
89 raise 109 raise
90 110
91 111
92 def RunEverything(bot_id, options, build_config): 112 def RunEverything(bot_id, options, build_config):
93 """Pull out the meat of main() in a unittest friendly manner""" 113 """Pull out the meat of main() in a unittest friendly manner"""
94 114
95 completed_stages_file = os.path.join(options.buildroot, '.completed_stages') 115 completed_stages_file = os.path.join(options.buildroot, '.completed_stages')
96 116
97 if options.resume and os.path.exists(completed_stages_file): 117 if options.resume and os.path.exists(completed_stages_file):
98 with open(completed_stages_file, 'r') as load_file: 118 with open(completed_stages_file, 'r') as load_file:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 default=False, 179 default=False,
160 help='Skip stages already successfully completed.') 180 help='Skip stages already successfully completed.')
161 parser.add_option('-f', '--revisionfile', 181 parser.add_option('-f', '--revisionfile',
162 help='file where new revisions are stored') 182 help='file where new revisions are stored')
163 parser.add_option('-t', '--tracking-branch', dest='tracking_branch', 183 parser.add_option('-t', '--tracking-branch', dest='tracking_branch',
164 default='cros/master', help='Run the buildbot on a branch') 184 default='cros/master', help='Run the buildbot on a branch')
165 parser.add_option('--nouprev', action='store_false', dest='uprev', 185 parser.add_option('--nouprev', action='store_false', dest='uprev',
166 default=True, 186 default=True,
167 help='Override values from buildconfig and never uprev.') 187 help='Override values from buildconfig and never uprev.')
168 parser.add_option('-u', '--url', dest='url', 188 parser.add_option('-u', '--url', dest='url',
169 default='http://git.chromium.org/git/manifest', 189 default=None,
170 help='Run the buildbot on internal manifest') 190 help='Override the GIT repo URL from the build config.')
171 191
172 (options, args) = parser.parse_args() 192 (options, args) = parser.parse_args()
173 193
174 if len(args) >= 1: 194 if len(args) >= 1:
175 bot_id = args[-1] 195 bot_id = args[-1]
176 build_config = _GetConfig(bot_id) 196 build_config = _GetConfig(bot_id, options)
177 else: 197 else:
178 parser.error('Invalid usage. Use -h to see usage.') 198 parser.error('Invalid usage. Use -h to see usage.')
179 199
180 RunEverything(bot_id, options, build_config) 200 RunEverything(bot_id, options, build_config)
181 201
182 202
183 if __name__ == '__main__': 203 if __name__ == '__main__':
184 main() 204 main()
OLDNEW
« no previous file with comments | « no previous file | buildbot/cbuildbot_commands.py » ('j') | buildbot/cbuildbot_commands.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698