[Buildbot-commits] buildbot/buildbot/process step.py,1.70,1.71

Brian Warner warner at users.sourceforge.net
Sat Oct 22 22:42:01 UTC 2005

Update of /cvsroot/buildbot/buildbot/buildbot/process
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32691/buildbot/process

Modified Files:
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-354
Creator:  Brian Warner <warner at lothar.com>

add some slave-versioning code

	* buildbot/slave/commands.py (cvs_ver): document new features

	* buildbot/process/step.py (BuildStep.slaveVersion): document it
	(BuildStep.slaveVersionNewEnough): more useful utility method
	* buildbot/test/test_steps.py (Version): start testing it

Index: step.py
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step.py,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- step.py	20 Oct 2005 22:32:48 -0000	1.70
+++ step.py	22 Oct 2005 22:41:58 -0000	1.71
@@ -614,8 +614,36 @@
     # utility methods that BuildSteps may find useful
     def slaveVersion(self, command, oldversion=None):
+        """Return the version number of the given slave command. For the
+        commands defined in buildbot.slave.commands, this is the value of
+        'cvs_ver' at the top of that file. Non-existent commands will return
+        a value of None. Buildslaves running buildbot-0.5.0 or earlier did
+        not respond to the version query: commands on those slaves will
+        return a value of OLDVERSION, so you can distinguish between old
+        buildslaves and missing commands.
+        If you know that <=0.5.0 buildslaves have the command you want (CVS
+        and SVN existed back then, but none of the other VC systems), then it
+        makes sense to call this with oldversion='old'. If the command you
+        want is newer than that, just leave oldversion= unspecified, and the
+        command will return None for a buildslave that does not implement the
+        command.
+        """
         return self.build.getSlaveCommandVersion(command, oldversion)
+    def slaveVersionNewEnough(self, command, minversion):
+        sv = self.build.getSlaveCommandVersion(command, None)
+        if sv is None:
+            return False
+        # the version we get back is a string form of the CVS version number
+        # of the slave's buildbot/slave/commands.py, something like 1.39 .
+        # This might change in the future (I might move away from CVS), but
+        # if so I'll keep updating that string with suitably-comparable
+        # values.
+        if sv.split(".") >= minversion.split("."):
+            return True
+        return False
     def addLog(self, name):
         loog = self.step_status.addLog(name)
         return loog

More information about the Commits mailing list