[Buildbot-commits] buildbot/buildbot/scripts tryclient.py,1.12,1.13

Brian Warner warner at users.sourceforge.net
Mon Apr 24 09:03:08 UTC 2006


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

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

improve the windowsness of test_vc and tryclient

	* buildbot/test/test_vc.py (*.capable): store the actual VC
	binary's pathname in VCS[vcname], so it can be retrieved later
	(CVSSupport.vc_try_checkout): incorporate Niklaus Giger's patch to
	strip out non-numeric timezone information, specifically the funky
	German string that his system produced that confuses CVS.
	(DarcsSupport.vc_create): use dovc() instead of vc(), this should
	allow Darcs tests to work on windows
	* buildbot/scripts/tryclient.py (SourceStampExtractor): use
	procutils.which() everywhere, to allow tryclient to work under
	windows. Also from Niklaus Giger, SF#1463394.

	* buildbot/twcompat.py (which): move the replacement for a missing
	twisted.python.procutils.which from test_vc.py to here, so it can
	be used in other places too (specifically tryclient.py)


Index: tryclient.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scripts/tryclient.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- tryclient.py	11 Apr 2006 06:12:59 -0000	1.12
+++ tryclient.py	24 Apr 2006 09:03:06 -0000	1.13
@@ -10,16 +10,21 @@
 from buildbot.scripts import runner
 from buildbot.util import now
 from buildbot.status import builder
+from buildbot.twcompat import which
 
 class SourceStampExtractor:
 
     def __init__(self, treetop, branch):
         self.treetop = treetop
         self.branch = branch
+        self.exe = which(self.vcexe)[0]
 
-    def do(self, cmd):
-        return utils.getProcessOutput(cmd[0], cmd[1:], env=os.environ,
+    def dovc(self, cmd):
+        """This accepts the arguments of a command, without the actual
+        command itself."""
+        return utils.getProcessOutput(self.exe, cmd, env=os.environ,
                                       path=self.treetop)
+
     def get(self):
         """Return a Deferred that fires with a SourceStamp instance."""
         d = self.getBaseRevision()
@@ -35,6 +40,7 @@
 
 class CVSExtractor(SourceStampExtractor):
     patchlevel = 0
+    vcexe = "cvs"
     def getBaseRevision(self):
         # this depends upon our local clock and the repository's clock pretty
         # in reasonable sync with each other
@@ -53,15 +59,17 @@
             # find out what those checked-out versions are.
             raise RuntimeError("Sorry, CVS 'try' builds don't work with "
                                "branches")
-        args = ['cvs', '-q', 'diff', '-u', '-D', self.baserev]
-        d = self.do(args)
+        args = ['-q', 'diff', '-u', '-D', self.baserev]
+        d = self.dovc(args)
         d.addCallback(self.readPatch, self.patchlevel)
         return d
 
 class SVNExtractor(SourceStampExtractor):
     patchlevel = 0
+    vcexe = "svn"
+
     def getBaseRevision(self):
-        d = self.do(['svn', "status", "-u"])
+        d = self.dovc(["status", "-u"])
         d.addCallback(self.parseStatus)
         return d
     def parseStatus(self, res):
@@ -90,13 +98,14 @@
         raise IndexError("Could not find 'Status against revision' in "
                          "SVN output: %s" % res)
     def getPatch(self, res):
-        d = self.do(["svn", "diff", "-r%d" % self.baserev])
+        d = self.dovc(["diff", "-r%d" % self.baserev])
         d.addCallback(self.readPatch, self.patchlevel)
         return d
 
 class BazExtractor(SourceStampExtractor):
+    vcexe = "baz"
     def getBaseRevision(self):
-        d = self.do(["baz", "tree-id"])
+        d = self.dovc(["tree-id"])
         d.addCallback(self.parseStatus)
         return d
     def parseStatus(self, res):
@@ -106,15 +115,16 @@
         self.branch = tid[slash+1:dd]
         self.baserev = tid[dd+2:]
     def getPatch(self, res):
-        d = self.do(["baz", "diff"])
+        d = self.dovc(["diff"])
         d.addCallback(self.readPatch, 1)
         return d
 
 class TlaExtractor(SourceStampExtractor):
+    vcexe = "tla"
     def getBaseRevision(self):
         # 'tla logs --full' gives us ARCHIVE/BRANCH--REVISION
         # 'tla logs' gives us REVISION
-        d = self.do(["tla", "logs", "--full", "--reverse"])
+        d = self.dovc(["logs", "--full", "--reverse"])
         d.addCallback(self.parseStatus)
         return d
     def parseStatus(self, res):
@@ -125,34 +135,36 @@
         self.baserev = tid[dd+2:]
 
     def getPatch(self, res):
-        d = self.do(["tla", "changes", "--diffs"])
+        d = self.dovc(["changes", "--diffs"])
         d.addCallback(self.readPatch, 1)
         return d
 
 class MercurialExtractor(SourceStampExtractor):
     patchlevel = 1
+    vcexe = "hg"
     def getBaseRevision(self):
-        d = self.do(["hg", "identify"])
+        d = self.dovc(["identify"])
         d.addCallback(self.parseStatus)
         return d
     def parseStatus(self, output):
         m = re.search(r'^(\w+)', output)
         self.baserev = m.group(0)
     def getPatch(self, res):
-        d = self.do(["hg", "diff"])
+        d = self.dovc(["diff"])
         d.addCallback(self.readPatch, self.patchlevel)
         return d
 
 class DarcsExtractor(SourceStampExtractor):
     patchlevel = 1
+    vcexe = "darcs"
     def getBaseRevision(self):
-        d = self.do(["darcs", "changes", "--context"])
+        d = self.dovc(["changes", "--context"])
         d.addCallback(self.parseStatus)
         return d
     def parseStatus(self, res):
         self.baserev = res # the whole context file
     def getPatch(self, res):
-        d = self.do(["darcs", "diff", "-u"])
+        d = self.dovc(["diff", "-u"])
         d.addCallback(self.readPatch, self.patchlevel)
         return d
 





More information about the Commits mailing list