[Buildbot-commits] buildbot/buildbot/slave commands.py,1.45,1.46

Brian Warner warner at users.sourceforge.net
Mon May 1 00:11:00 UTC 2006


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

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

set LC_ALL=C, accomodate non-DNotify platforms in testTryJobdir

	* buildbot/test/test_vc.py (VCBase.runCommand): set $LC_ALL="C" to
	make sure child commands emit messages in english, so our regexps
	will match. Thanks to Nikaus Giger for identifying the problems.
	(VCBase._do_vctest_export_1): mode="export" is not responsible
	for setting the "got_revision" property, since in many cases it is
	not convenient to determine.
	(SVNSupport.capable): when running 'svn --version' to check for
	ra_local, we want error messages in english
	* buildbot/test/test_slavecommand.py 
	(ShellBase.testShellMissingCommand): set $LC_ALL="C" to get bash
	to emit the error message in english

	* buildbot/slave/commands.py (SourceBase.setup): stash a copy of
	the environment with $LC_ALL="C" so that Commands which need to
	parse the output of their child processes can obtain it in
	english.
	(SVN.parseGotRevision): call "svn info" afterwards instead of
	watching the output of the "svn update" or "svn checkout".
	(Darcs.parseGotRevision): use $LC_ALL="C" when running the command
	(Arch.parseGotRevision): same
	(Bazaar.parseGotRevision): same
	(Mercurial.parseGotRevision): same

	* buildbot/scripts/tryclient.py (SourceStampExtractor.dovc): set
	$LC_ALL="C" when running commands under 'buildbot try', too

	* buildbot/test/__init__.py: remove the global os.environ()
	setting, instead we do it just for the tests that run commands and
	need to parse their output.

	* buildbot/test/test_scheduler.py (Scheduling.testTryJobdir):
	remove the overly-short .timeout on this test, because non-DNotify
	platforms must fall back to polling which happens at 10 second
	intervals, so a 5 second timeout would never succeed.


Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- commands.py	24 Apr 2006 06:45:37 -0000	1.45
+++ commands.py	1 May 2006 00:10:57 -0000	1.46
@@ -632,6 +632,12 @@
     sourcedata = ""
 
     def setup(self, args):
+        # if we need to parse the output, use this environment. Otherwise
+        # command output will be in whatever the buildslave's native language
+        # has been set to.
+        self.env = os.environ.copy()
+        self.env['LC_ALL'] = "C"
+
         self.workdir = args['workdir']
         self.mode = args.get('mode', "update")
         self.revision = args.get('revision')
@@ -1001,12 +1007,25 @@
     def parseGotRevision(self):
         # svn checkout operations finish with 'Checked out revision 16657.'
         # svn update operations finish the line 'At revision 16654.'
-        lines = self.command.stdout.rstrip().split("\n")
-        lastline = lines[-1]
-        r = re.search(r'revision (\d+)\.', lastline)
-        if r:
-            return int(r.group(1))
-        return None
+        # But we don't use those. Instead, run 'svn info'.
+        if self.mode == "export":
+            # without the .svn metadir, svn info won't work
+            return None
+        command = ["svn", "info"]
+        c = ShellCommand(self.builder, command,
+                         os.path.join(self.builder.basedir, self.srcdir),
+                         environ=self.env,
+                         sendStdout=False, sendStderr=False, sendRC=False,
+                         keepStdout=True)
+        c.usePTY = False
+        d = c.start()
+        def _parse(res):
+            r = re.search(r'^Revision: (\d+)$', c.stdout, re.M)
+            if r:
+                return int(r.group(1))
+            return None
+        d.addCallback(_parse)
+        return d
 
 
 registerSlaveCommand("svn", SVN, cvs_ver)
@@ -1079,6 +1098,7 @@
         command = ["darcs", "changes", "--context"]
         c = ShellCommand(self.builder, command,
                          os.path.join(self.builder.basedir, self.srcdir),
+                         environ=self.env,
                          sendStdout=False, sendStderr=False, sendRC=False,
                          keepStdout=True)
         c.usePTY = False
@@ -1245,6 +1265,7 @@
         command = ["tla", "logs", "--full", "--reverse"]
         c = ShellCommand(self.builder, command,
                          os.path.join(self.builder.basedir, self.srcdir),
+                         environ=self.env,
                          sendStdout=False, sendStderr=False, sendRC=False,
                          keepStdout=True)
         c.usePTY = False
@@ -1306,6 +1327,7 @@
         command = ["baz", "tree-id"]
         c = ShellCommand(self.builder, command,
                          os.path.join(self.builder.basedir, self.srcdir),
+                         environ=self.env,
                          sendStdout=False, sendStderr=False, sendRC=False,
                          keepStdout=True)
         c.usePTY = False
@@ -1389,6 +1411,7 @@
         command = ["hg", "identify"]
         c = ShellCommand(self.builder, command,
                          os.path.join(self.builder.basedir, self.srcdir),
+                         environ=self.env,
                          sendStdout=False, sendStderr=False, sendRC=False,
                          keepStdout=True)
         d = c.start()





More information about the Commits mailing list