[Buildbot-commits] buildbot/buildbot/process base.py, 1.67, 1.68 step.py, 1.95, 1.96

Brian Warner warner at users.sourceforge.net
Sun Aug 6 20:05:23 UTC 2006


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

Modified Files:
	base.py step.py 
Log Message:
[project @ add BuildStep.getSlaveName, make useLog more flexible]

Original author: warner at lothar.com
Date: 2006-08-06 19:40:26

Index: base.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/base.py,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- base.py	16 Jun 2006 05:28:13 -0000	1.67
+++ base.py	6 Aug 2006 20:05:21 -0000	1.68
@@ -263,6 +263,8 @@
 
     def getSlaveCommandVersion(self, command, oldversion=None):
         return self.slavebuilder.getSlaveCommandVersion(command, oldversion)
+    def getSlaveName(self):
+        return self.slavebuilder.slave.slavename
 
     def setupStatus(self, build_status):
         self.build_status = build_status

Index: step.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step.py,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- step.py	20 Jun 2006 08:09:15 -0000	1.95
+++ step.py	6 Aug 2006 20:05:21 -0000	1.96
@@ -266,12 +266,36 @@
     def __repr__(self):
         return "<RemoteCommand '%s' at %d>" % (self.remote_command, id(self))
 
-    def useLog(self, loog, closeWhenFinished=False):
+    def useLog(self, loog, closeWhenFinished=False, logfileName=None):
+        """Start routing messages from a remote logfile to a local LogFile
+
+        I take a local ILogFile instance in 'loog', and arrange to route
+        remote log messages for the logfile named 'logfileName' into it. By
+        default this logfileName comes from the ILogFile itself (using the
+        name by which the ILogFile will be displayed), but the 'logfileName'
+        argument can be used to override this. For example, if
+        logfileName='stdio', this logfile will collect text from the stdout
+        and stderr of the command.
+
+        @param loog: an instance which implements ILogFile
+        @param closeWhenFinished: a boolean, set to False if the logfile
+                                  will be shared between multiple
+                                  RemoteCommands. If True, the logfile will
+                                  be closed when this ShellCommand is done
+                                  with it.
+        @param logfileName: a string, which indicates which remote log file
+                            should be routed into this ILogFile. This should
+                            match one of the keys of the logfiles= argument
+                            to ShellCommand.
+
+        """
+
         assert providedBy(loog, interfaces.ILogFile)
-        name = loog.getName()
-        assert name not in self.logs
-        self.logs[name] = loog
-        self._closeWhenFinished[name] = closeWhenFinished
+        if not logfileName:
+            logfileName = loog.getName()
+        assert logfileName not in self.logs
+        self.logs[logfileName] = loog
+        self._closeWhenFinished[logfileName] = closeWhenFinished
 
     def start(self):
         log.msg("LoggedRemoteCommand.start")
@@ -797,11 +821,19 @@
             return True
         return False
 
+    def getSlaveName(self):
+        return self.build.getSlaveName()
+
     def addLog(self, name):
         loog = self.step_status.addLog(name)
         self._connectPendingLogObservers()
         return loog
 
+    # TODO: add a getLog() ? At the moment all logs have to be retrieved from
+    # the RemoteCommand that created them, but for status summarizers it
+    # would be more convenient to get them from the BuildStep / BSStatus,
+    # especially if there are multiple RemoteCommands involved.
+
     def addCompleteLog(self, name, text):
         log.msg("addCompleteLog(%s)" % name)
         loog = self.step_status.addLog(name)





More information about the Commits mailing list