[Buildbot-commits] buildbot/buildbot/status tinderbox.py,1.9,1.10

Brian Warner warner at users.sourceforge.net
Tue Apr 29 16:18:01 UTC 2008


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

Modified Files:
	tinderbox.py 
Log Message:
[project @ status/tinderbox.py: add useChangeTim= argument, closes #213]

Original author: warner at lothar.com
Date: 2008-04-29 15:47:19+00:00

Index: tinderbox.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/tinderbox.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- tinderbox.py	29 Apr 2008 16:09:42 -0000	1.9
+++ tinderbox.py	29 Apr 2008 16:17:59 -0000	1.10
@@ -34,12 +34,14 @@
 
     compare_attrs = ["extraRecipients", "fromaddr", "categories", "builders",
                      "addLogs", "relayhost", "subject", "binaryURL", "tree",
-                     "logCompression", "errorparser", "columnName"]
+                     "logCompression", "errorparser", "columnName",
+                     "useChangeTime"]
 
     def __init__(self, fromaddr, tree, extraRecipients,
                  categories=None, builders=None, relayhost="localhost",
                  subject="buildbot %(result)s in %(builder)s", binaryURL="",
-                 logCompression="", errorparser="unix", columnName=None):
+                 logCompression="", errorparser="unix", columnName=None,
+                 useChangeTime=False):
         """
         @type  fromaddr: string
         @param fromaddr: the email address to be used in the 'From' header.
@@ -97,6 +99,10 @@
                            about (not recommended). When columnName is a
                            WithProperties instance it will be interpolated
                            as such. See WithProperties for more detail.
+        @type  useChangeTime: bool
+        @param useChangeTime: When True, the time of the first Change for a
+                              build is used as the builddate. When False,
+                              the current time is used as the builddate.
         """
 
         mail.MailNotifier.__init__(self, fromaddr, categories=categories,
@@ -108,6 +114,7 @@
         self.binaryURL = binaryURL
         self.logCompression = logCompression
         self.errorparser = errorparser
+        self.useChangeTime = useChangeTime
         assert columnName is None or type(columnName) is str \
             or isinstance(columnName, WithProperties), \
             "columnName must be None, a string, or a WithProperties instance"
@@ -131,7 +138,15 @@
         text += "%s tree: %s\n" % (t, self.tree)
         # the start time
         # getTimes() returns a fractioned time that tinderbox doesn't understand
-        text += "%s builddate: %s\n" % (t, int(build.getTimes()[0]))
+        builddate = int(build.getTimes()[0])
+        # attempt to pull a Change time from this Build's Changes.
+        # if that doesn't work, fall back on the current time
+        if self.useChangeTime:
+            try:
+                builddate = build.getChanges()[-1].when
+            except:
+                pass
+        text += "%s builddate: %s\n" % (t, builddate)
         text += "%s status: " % t
 
         if results == "building":
@@ -151,13 +166,13 @@
 
         if self.columnName is None:
             # use the builder name
-            text = "%s build: %s\n" % (t, 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)
+            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))
+            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)





More information about the Commits mailing list