[Buildbot-commits] buildbot/buildbot/status tinderbox.py,1.7,1.8

Brian Warner warner at users.sourceforge.net
Thu Nov 1 06:38:07 UTC 2007


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

Modified Files:
	tinderbox.py 
Log Message:
[project @ status/tinderbox: add 'columnName' argument, closes #120]

Original author: warner at lothar.com
Date: 2007-11-01 06:37:18+00:00

Index: tinderbox.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/tinderbox.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- tinderbox.py	29 Sep 2007 22:58:15 -0000	1.7
+++ tinderbox.py	1 Nov 2007 06:38:05 -0000	1.8
@@ -8,6 +8,7 @@
 from buildbot import interfaces
 from buildbot.status import mail
 from buildbot.status.builder import SUCCESS, WARNINGS
+from buildbot.steps.shell import WithProperties
 
 import zlib, bz2, base64
 
@@ -33,12 +34,12 @@
 
     compare_attrs = ["extraRecipients", "fromaddr", "categories", "builders",
                      "addLogs", "relayhost", "subject", "binaryURL", "tree",
-                     "logCompression", "errorparser"]
+                     "logCompression", "errorparser", "columnName"]
 
     def __init__(self, fromaddr, tree, extraRecipients,
                  categories=None, builders=None, relayhost="localhost",
                  subject="buildbot %(result)s in %(builder)s", binaryURL="",
-                 logCompression="", errorparser="unix"):
+                 logCompression="", errorparser="unix", columnName=None):
         """
         @type  fromaddr: string
         @param fromaddr: the email address to be used in the 'From' header.
@@ -87,6 +88,15 @@
         @param errorparser: The error parser that the Tinderbox server
                             should use when scanning the log file.
                             Default is "unix".
+
+        @type  columnName: string
+        @param columnName: When columnName is None, use the buildername as
+                           the Tinderbox column name. When columnName is a
+                           string this exact string will be used for all
+                           builders that this TinderboxMailNotifier cares
+                           about (not recommended). When columnName is a
+                           WithProperties instance it will be interpolated
+                           as such. See WithProperties for more detail.
         """
 
         mail.MailNotifier.__init__(self, fromaddr, categories=categories,
@@ -98,6 +108,10 @@
         self.binaryURL = binaryURL
         self.logCompression = logCompression
         self.errorparser = errorparser
+        assert columnName is None or type(columnName) is str \
+            or isinstance(columnName, WithProperties), \
+            "columnName must be None, a string, or a WithProperties instance"
+        self.columnName = columnName
 
     def buildStarted(self, name, build):
         builder = build.getBuilder()
@@ -135,7 +149,17 @@
 
         text += "\n";
 
-        text += "%s build: %s\n" % (t, name)
+        if self.columnName is None:
+            # use the builder name
+            text = "%s build: %s\n" % (t, name)
+        elif type(self.columnName) is str:
+            # use the exact string given
+            text = "%s build: %s\n" % (t, self.columnName)
+        elif isinstance(self.columnName, WithProperties):
+            # interpolate the WithProperties instance, use that
+            text = "%s build: %s\n" % (t, self.columnName.render(build))
+        else:
+            raise Exception("columnName is an unhandled value")
         text += "%s errorparser: %s\n" % (t, self.errorparser)
 
         # if the build just started...





More information about the Commits mailing list