[Buildbot-commits] buildbot/buildbot/slave commands.py,1.27,1.28
Brian Warner
warner at users.sourceforge.net
Tue May 3 20:02:08 UTC 2005
Update of /cvsroot/buildbot/buildbot/buildbot/slave
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3245/buildbot/slave
Modified Files:
commands.py
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-117
Creator: Brian Warner <warner at monolith.lothar.com>
support Baz, revisions for tla+baz, make error steps terminate build
* buildbot/process/base.py (Build.startBuild): fix a bug that
caused an exception when the build terminated in the very first
step.
(Build.stepDone): let steps return a status of EXCEPTION. This
terminates the build right away, and sets the build's overall
status to EXCEPTION too.
* buildbot/process/step.py (BuildStep.failed): return a status of
EXCEPTION when that is what has happened.
* buildbot/process/step.py (Arch.computeSourceRevision): finally
implement this, allowing Arch-based projects to get precise
checkouts instead of always using the latest code
(Bazaar): create variant of Arch to let folks use baz instead of
tla. Requires a new buildslave too.
* buildbot/slave/commands.py (Arch): add 'revision' argument
(Bazaar): create variant of Arch that uses baz instead of tla.
Remove the code that extracts the archive name from the
register-archive output, since baz doesn't provide it, and require
the user provide both the archive name and its location.
* buildbot/test/test_vc.py (VC.testBazaar): added tests
Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- commands.py 26 Apr 2005 21:37:16 -0000 1.27
+++ commands.py 3 May 2005 20:02:05 -0000 1.28
@@ -13,6 +13,7 @@
# version history:
# >=1.17: commands are interruptable
+# >=1.28: Arch understands 'revision', added Bazaar
class CommandInterrupted(Exception):
pass
@@ -816,18 +817,21 @@
['url'] (required): the repository string
['version'] (required): which version (i.e. branch) to retrieve
+ ['revision'] (optional): the 'patch-NN' argument to check out
['archive']: the archive name to use. If None, use the archive's default
['build-config']: if present, give to 'tla build-config' after checkout
"""
+ arch_command = "tla"
header = "arch operation"
- archive = None
buildconfig = None
def setup(self, args):
SourceBase.setup(self, args)
+ self.archive = args.get('archive')
self.url = args['url']
self.version = args['version']
+ self.revision = args.get('revision')
def sourcedirIsUpdateable(self):
if os.path.exists(os.path.join(self.builder.basedir,
@@ -839,25 +843,21 @@
def doVCUpdate(self):
# update: possible for mode in ('copy', 'update')
d = os.path.join(self.builder.basedir, self.srcdir)
- command = ['tla', 'replay']
+ command = [self.arch_command, 'replay']
+ if self.revision:
+ command.append(self.revision)
c = ShellCommand(self.builder, command, d,
sendRC=False, timeout=self.timeout)
self.command = c
return c.start()
def doVCFull(self):
- # to do a checkout, we first must register the archive. This
- # involves passing the URL to arch and letting it tell us the
- # archive name.
+ # to do a checkout, we must first "register" the archive by giving
+ # the URL to tla, which will go to the repository at that URL and
+ # figure out the archive name. tla will tell you the archive name
+ # when it is done, and all further actions must refer to this name.
- if self.args['archive']:
- # explicit archive name, we don't need to extract the default
- # name from stdout
- self.archive = self.args['archive']
- command = ['tla', 'register-archive', '--force',
- self.archive, self.url]
- else:
- command = ['tla', 'register-archive', '--force', self.url]
+ command = [self.arch_command, 'register-archive', '--force', self.url]
c = ShellCommand(self.builder, command, self.builder.basedir,
sendRC=False, keepStdout=True,
timeout=self.timeout)
@@ -868,19 +868,30 @@
return d
def _didRegister(self, res, c):
- if not self.archive:
- r = re.search(r'Registering archive: (\S+)\s*$', c.stdout)
- if not r:
- msg = "Unable to register archive"
+ # find out what tla thinks the archive name is. If the user told us
+ # to use something specific, make sure it matches.
+ r = re.search(r'Registering archive: (\S+)\s*$', c.stdout)
+ if r:
+ msg = "tla reports archive name is '%s'" % r.group(1)
+ log.msg(msg)
+ self.builder.sendUpdate({'header': msg+"\n"})
+ if self.archive and r.group(1) != self.archive:
+ msg = (" mismatch, we wanted an archive named '%s'"
+ % self.archive)
log.msg(msg)
- log.msg('output is \"%s\"' % c.stdout)
self.builder.sendUpdate({'header': msg+"\n"})
raise AbandonChain(-1)
self.archive = r.group(1)
- log.msg("computed archive name '%s'" % self.archive)
- # TODO: revision
- command = ['tla', 'get', '--archive', self.archive, '--no-pristine',
- self.version, self.srcdir]
+ assert self.archive, "need archive name to continue"
+ return self._doGet()
+
+ def _doGet(self):
+ ver = self.version
+ if self.revision:
+ ver += "--%s" % self.revision
+ command = [self.arch_command, 'get', '--archive', self.archive,
+ '--no-pristine',
+ ver, self.srcdir]
c = ShellCommand(self.builder, command, self.builder.basedir,
sendRC=False, timeout=self.timeout)
self.command = c
@@ -892,7 +903,7 @@
def _didGet(self, res):
d = os.path.join(self.builder.basedir, self.srcdir)
- command = ['tla', 'build-config', self.buildconfig]
+ command = [self.arch_command, 'build-config', self.buildconfig]
c = ShellCommand(self.builder, command, d,
sendRC=False, timeout=self.timeout)
self.command = c
@@ -902,6 +913,47 @@
registerSlaveCommand("arch", Arch, cvs_ver)
+class Bazaar(Arch):
+ """Bazaar (/usr/bin/baz) is an alternative client for Arch repositories.
+ It is mostly option-compatible, but archive registration is different
+ enough to warrant a separate Command.
+
+ ['archive'] (required): the name of the archive being used
+ """
+
+ arch_command = "baz"
+
+ def setup(self, args):
+ Arch.setup(self, args)
+ # baz doesn't emit the repository name after registration (and
+ # grepping through the output of 'baz archives' is too hard), so we
+ # require that the buildmaster configuration to provide both the
+ # archive name and the URL.
+ self.archive = args['archive'] # required for Baz
+
+ # in _didRegister, the regexp won't match, so we'll stick with the name
+ # in self.archive
+
+ def _doGet(self):
+ # baz prefers ARCHIVE/VERSION. This will work even if
+ # my-default-archive is not set.
+ ver = self.archive + "/" + self.version
+ if self.revision:
+ ver += "--%s" % self.revision
+ command = [self.arch_command, 'get', '--no-pristine',
+ ver, self.srcdir]
+ c = ShellCommand(self.builder, command, self.builder.basedir,
+ sendRC=False, timeout=self.timeout)
+ self.command = c
+ d = c.start()
+ d.addCallback(self._abandonOnFailure)
+ if self.buildconfig:
+ d.addCallback(self._didGet)
+ return d
+
+
+
+registerSlaveCommand("bazaar", Bazaar, cvs_ver)
class P4Sync(SourceBase):
"""A partial P4 source-updater. Requires manual setup of a per-slave P4
More information about the Commits
mailing list