| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 """Module for chromium-os-specific git source that dumps revisions.""" | |
| 6 | |
| 7 import copy | |
| 8 | |
| 9 from buildbot.steps import source | |
| 10 from buildbot.process import buildstep | |
| 11 | |
| 12 # Relative path to revision file for cbuildbot. | |
| 13 PFQ_REVISION_FILE = 'chromite/buildbot/revisions.pfq' | |
| 14 | |
| 15 class GitRevisionDropper(source.Source): | |
| 16 """Drops a list of revisions from multiple git repositories.""" | |
| 17 | |
| 18 name = 'gitrevisiondropper' | |
| 19 | |
| 20 def computeSourceRevision(self, changes): | |
| 21 """Creates a list of revision numbers. Revision numbers coming from | |
| 22 cros git hooks are folder_name:revision. | |
| 23 | |
| 24 This is a hook method provided by the parent source.Source class and | |
| 25 default implementation in source.Source returns None. Return value of this | |
| 26 method is be used to set 'revision' argument value for startVC() method.""" | |
| 27 revision_list = '' | |
| 28 if not changes: | |
| 29 return None | |
| 30 | |
| 31 def GrabRevision(change): | |
| 32 """Handle revision == None or any invalid value.""" | |
| 33 return '%s@%s' % (change.repository, change.revision) | |
| 34 | |
| 35 for change in changes: | |
| 36 revision = GrabRevision(change) | |
| 37 revision_list = '%s %s' % (revision_list, revision) | |
| 38 revision_list = revision_list.strip() | |
| 39 return revision_list | |
| 40 | |
| 41 def startVC(self, branch, revision, patch): | |
| 42 """Drops a source stamp for other steps""" | |
| 43 args = copy.copy(self.args) | |
| 44 args['command'] = 'echo "%s" > %s' % (revision, PFQ_REVISION_FILE) | |
| 45 # Shell is defined by buildbot.slave.SlaveShellCommand. | |
| 46 cmd = buildstep.LoggedRemoteCommand("shell", args) | |
| 47 self.startCommand(cmd, []) | |
| OLD | NEW |