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

Side by Side Diff: buildbot/cbuildbot_stages.py

Issue 6691047: Merge MVP script into cbuildbot. (Closed) Base URL: http://git.chromium.org/git/chromite.git@master
Patch Set: renamed board -> build_name, fix dry_run bug, fixed nits. 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 | « buildbot/cbuildbot_config.py ('k') | buildbot/cbuildbot_stages_unittest.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 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Module containing the various stages that a builder runs.""" 5 """Module containing the various stages that a builder runs."""
6 6
7 import os 7 import os
8 import re 8 import re
9 import sys 9 import sys
10 import tempfile 10 import tempfile
11 11
12 import chromite.buildbot.cbuildbot_commands as commands 12 import chromite.buildbot.cbuildbot_commands as commands
13 import chromite.buildbot.manifest_version as manifest_version
13 import chromite.lib.cros_build_lib as cros_lib 14 import chromite.lib.cros_build_lib as cros_lib
14 15
15 _FULL_BINHOST = 'FULL_BINHOST' 16 _FULL_BINHOST = 'FULL_BINHOST'
16 PUBLIC_OVERLAY = '%(buildroot)s/src/third_party/chromiumos-overlay' 17 PUBLIC_OVERLAY = '%(buildroot)s/src/third_party/chromiumos-overlay'
17 _CROS_ARCHIVE_URL = 'CROS_ARCHIVE_URL' 18 _CROS_ARCHIVE_URL = 'CROS_ARCHIVE_URL'
18 OVERLAY_LIST_CMD = '%(buildroot)s/src/platform/dev/host/cros_overlay_list' 19 OVERLAY_LIST_CMD = '%(buildroot)s/src/platform/dev/host/cros_overlay_list'
19 20
20 class BuilderStage(): 21 class BuilderStage():
21 """Parent class for stages to be performed by a builder.""" 22 """Parent class for stages to be performed by a builder."""
22 name_stage_re = re.compile('(\w+)Stage') 23 name_stage_re = re.compile('(\w+)Stage')
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 self.Results.Record(self._name, e) 251 self.Results.Record(self._name, e)
251 raise 252 raise
252 else: 253 else:
253 self.Results.Record(self._name, self.Results.SUCCESS) 254 self.Results.Record(self._name, self.Results.SUCCESS)
254 finally: 255 finally:
255 self._Finish() 256 self._Finish()
256 257
257 258
258 class SyncStage(BuilderStage): 259 class SyncStage(BuilderStage):
259 """Stage that performs syncing for the builder.""" 260 """Stage that performs syncing for the builder."""
261
260 def _PerformStage(self): 262 def _PerformStage(self):
261 if self._options.clobber or not os.path.isdir(os.path.join(self._build_root, 263 if self._options.clobber or not os.path.isdir(os.path.join(self._build_root,
262 '.repo')): 264 '.repo')):
263 commands.FullCheckout(self._build_root, self._options.tracking_branch, 265 commands.FullCheckout(self._build_root, self._options.tracking_branch,
264 url=self._options.url) 266 url=self._build_config['git_url'])
265 self._ExtractOverlays()
266 else: 267 else:
267 commands.PreFlightRinse(self._build_root, self._build_config['board'], 268 commands.PreFlightRinse(self._build_root, self._build_config['board'],
268 self._options.tracking_branch, 269 self._options.tracking_branch,
269 BuilderStage.rev_overlays) 270 BuilderStage.rev_overlays)
270 BuilderStage.old_binhost = self._GetPortageEnvVar(_FULL_BINHOST) 271 BuilderStage.old_binhost = self._GetPortageEnvVar(_FULL_BINHOST)
271 commands.IncrementalCheckout(self._build_root) 272 commands.IncrementalCheckout(self._build_root)
272 273
273 # Check that all overlays can be found. 274 # Check that all overlays can be found.
275 self._ExtractOverlays() # Our list of overlays are from pre-sync, refresh
274 for path in BuilderStage.rev_overlays: 276 for path in BuilderStage.rev_overlays:
275 assert os.path.isdir(path), 'Missing overlay: %s' % path 277 assert os.path.isdir(path), 'Missing overlay: %s' % path
276 278
277 279
280 class ManifestVersionedSyncStage(BuilderStage):
281 """Stage that generates a unique manifest file, and sync's to it."""
282
283 build_version = None
284
285 def _PerformStage(self):
286 # Need to determine branch and set a local value here
287 branch = self._options.tracking_branch.split('/')
288 increment = 'patch'
289
290 if not branch[1]:
sosa 2011/04/13 18:35:10 if this is an array of length 1 won't this throw a
dgarrett 2011/04/13 20:57:35 For that matter, what is a tracking branch, and ho
djmm 2011/04/14 00:37:49 Yes that's probably better.
291 branch[1] = 'master'
292 increment = 'branch' # TODO Is this right?
sosa 2011/04/13 18:35:10 Remove TODO
dgarrett 2011/04/13 20:57:35 Done.
293
294 next_version = manifest_version.GenerateWorkload(
295 tmp_dir='/tmp/git.root',
296 source_repo=self._build_config['git_url'],
297 manifest_repo=self._build_config['manifest_version'],
298 branch=branch[1],
299 version_file=os.path.join('src/third_party/chromiumos-overlay',
300 'chromeos/config/chromeos_version.sh'),
301 build_name=self._build_config['board'],
302 incr_type=increment,
303 dry_run=self._options.debug)
304
305 if not next_version:
306 print 'AUTOREV: Nothing to build!'
307 sys.exit(0);
308
309 # Store off this value where the Completion stage can find it...
310 ManifestVersionedSyncStage.build_version = next_version
311
312 commands.ManifestCheckout(self._build_root,
313 self._options.tracking_branch,
314 next_version,
315 url=self._build_config['manifest_version'])
316
317 # Check that all overlays can be found.
318 self._ExtractOverlays() # Our list of overlays are from pre-sync, refresh
319 for path in BuilderStage.rev_overlays:
320 assert os.path.isdir(path), 'Missing overlay: %s' % path
321
322
323 class ManifestVersionedSyncCompletionStage(BuilderStage):
324 """Stage that records board specific results for a unique manifest file."""
325
326 def __init__(self, bot_id, options, build_config, success):
327 BuilderStage.__init__(self, bot_id, options, build_config)
328 self.success = success
329
330 def _PerformStage(self):
331
332 if not ManifestVersionedSyncStage.build_version:
333 # Nothing to do if ManifestVersionedSyncStage (or an earlier stage)
334 # didn't complete. I don't want an additional error here to mask the
335 # original error.
336 return
337
338 manifest_version.UpdateStatus(
339 tmp_dir='/tmp/git.root',
340 manifest_repo=self._build_config['manifest_version'],
341 build_name=self._build_config['board'],
342 build_version=ManifestVersionedSyncStage.build_version,
343 success=self.success,
344 dry_run=self._options.debug)
345
278 class BuildBoardStage(BuilderStage): 346 class BuildBoardStage(BuilderStage):
279 """Stage that is responsible for building host pkgs and setting up a board.""" 347 """Stage that is responsible for building host pkgs and setting up a board."""
280 def _PerformStage(self): 348 def _PerformStage(self):
281 chroot_path = os.path.join(self._build_root, 'chroot') 349 chroot_path = os.path.join(self._build_root, 'chroot')
282 board_path = os.path.join(chroot_path, 'build', self._build_config['board']) 350 board_path = os.path.join(chroot_path, 'build', self._build_config['board'])
283 if not os.path.isdir(chroot_path) or self._build_config['chroot_replace']: 351 if not os.path.isdir(chroot_path) or self._build_config['chroot_replace']:
284 commands.MakeChroot( 352 commands.MakeChroot(
285 self._build_root, self._build_config['chroot_replace']) 353 self._build_root, self._build_config['chroot_replace'])
286 354
287 if not os.path.isdir(board_path): 355 if not os.path.isdir(board_path):
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 def _PerformStage(self): 460 def _PerformStage(self):
393 if self._build_type in ('preflight', 'chrome'): 461 if self._build_type in ('preflight', 'chrome'):
394 commands.UploadPrebuilts( 462 commands.UploadPrebuilts(
395 self._build_root, self._build_config['board'], 463 self._build_root, self._build_config['board'],
396 self._build_config['rev_overlays'], [BuilderStage.new_binhost], 464 self._build_config['rev_overlays'], [BuilderStage.new_binhost],
397 self._build_type, self._options.chrome_rev) 465 self._build_type, self._options.chrome_rev)
398 466
399 commands.UprevPush(self._build_root, self._options.tracking_branch, 467 commands.UprevPush(self._build_root, self._options.tracking_branch,
400 self._build_config['board'], BuilderStage.push_overlays, 468 self._build_config['board'], BuilderStage.push_overlays,
401 self._options.debug) 469 self._options.debug)
OLDNEW
« no previous file with comments | « buildbot/cbuildbot_config.py ('k') | buildbot/cbuildbot_stages_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698