[Buildbot-commits] buildbot/buildbot/status html.py,1.69,1.70 words.py,1.41,1.42 mail.py,1.19,1.20

Brian Warner warner at users.sourceforge.net
Wed Oct 19 05:59:36 UTC 2005


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

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

use getURLForThing to add per-Build URLs to status messages

	* buildbot/status/html.py: provide 'status' argument to most
	StatusResourceFOO objects
	(StatusResourceBuild.body): href-ify the Builder name, add "Steps
	and Logfiles" section to make the Build page into a more-or-less
	comprehensive source of status information about the build

	* buildbot/status/mail.py (MailNotifier): include the Build's URL
	* buildbot/status/words.py (IrcStatusBot.buildFinished): same


Index: html.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- html.py	14 Oct 2005 19:42:40 -0000	1.69
+++ html.py	19 Oct 2005 05:59:34 -0000	1.70
@@ -176,8 +176,9 @@
 class StatusResourceBuildStep(HtmlResource):
     title = "Build Step"
 
-    def __init__(self, step):
+    def __init__(self, status, step):
         HtmlResource.__init__(self)
+        self.status = status
         self.step = step
 
     def body(self, request):
@@ -231,8 +232,9 @@
 class StatusResourceTestResult(HtmlResource):
     title = "Test Logs"
 
-    def __init__(self, name, result):
+    def __init__(self, status, name, result):
         HtmlResource.__init__(self)
+        self.status = status
         self.name = name
         self.result = result
 
@@ -253,8 +255,9 @@
 class StatusResourceTestResults(HtmlResource):
     title = "Test Results"
 
-    def __init__(self, results):
+    def __init__(self, status, results):
         HtmlResource.__init__(self)
+        self.status = status
         self.results = results
 
     def body(self, request):
@@ -281,7 +284,7 @@
         try:
             name = tuple(path.split("."))
             result = self.results[name]
-            return StatusResourceTestResult(name, result)
+            return StatusResourceTestResult(self.status, name, result)
         except KeyError:
             return NoResource("No such test name '%s'" % path)
 
@@ -290,17 +293,19 @@
 class StatusResourceBuild(HtmlResource):
     title = "Build"
 
-    def __init__(self, build, control):
+    def __init__(self, status, build, control):
         HtmlResource.__init__(self)
+        self.status = status
         self.build = build
         self.control = control
 
     def body(self, request):
         b = self.build
         # the color in the following line gives python-mode trouble
-        data = ("<h1>Build %s:#%d</h1>\n"
+        data = ("<h1>Build <a href=\"%s\">%s</a>:#%d</h1>\n"
                 "<h2>Reason:</h2>\n%s\n"
-                % (b.getBuilder().getName(), b.getNumber(),
+                % (self.status.getURLForThing(b.getBuilder()),
+                   urllib.quote(b.getBuilder().getName()), b.getNumber(),
                    html.escape(b.getReason())))
         if b.isFinished():
             data += "<h4>Buildslave: %s</h4>\n" % html.escape(b.getSlavename())
@@ -325,6 +330,22 @@
                 </form>
                 """
 
+        data += "<h2>Steps and Logfiles:</h2>\n"
+        if b.getLogs():
+            data += "<ol>\n"
+            for s in b.getSteps():
+                data += " <li>%s [%s]\n" % (s.getName(),
+                                            " ".join(s.getText()))
+                if s.getLogs():
+                    data += "  <ol>\n"
+                    for logfile in s.getLogs():
+                        data += ("   <li><a href=\"%s\">%s</a></li>\n" %
+                                 (self.status.getURLForThing(logfile),
+                                  logfile.getName()))
+                    data += "  </ol>\n"
+                data += " </li>\n"
+            data += "</ol>\n"
+
         data += ("<h2>Blamelist:</h2>\n"
                  " <ol>\n")
         for who in b.getResponsibleUsers():
@@ -362,21 +383,23 @@
     def getChild(self, path, request):
         if path == "tests":
             # TODO: this will collide with a step named 'tests'
-            return StatusResourceTestResults(self.build.getTestResults())
+            return StatusResourceTestResults(self.status,
+                                             self.build.getTestResults())
         if path == "stop":
             return self.stop(request)
         stepname = path
         steps = self.build.getSteps()
         for s in steps:
             if s.getName() == stepname:
-                return StatusResourceBuildStep(s)
+                return StatusResourceBuildStep(self.status, s)
         return NoResource("No such BuildStep '%s'" % stepname)
 
 # $builder
 class StatusResourceBuilder(HtmlResource):
 
-    def __init__(self, builder, control):
+    def __init__(self, status, builder, control):
         HtmlResource.__init__(self)
+        self.status = status
         self.title = builder.getName() + " Builder"
         self.builder = builder
         self.control = control
@@ -498,15 +521,16 @@
                 control = None
                 if self.control:
                     control = self.control.getBuild(num)
-                return StatusResourceBuild(build, control)
+                return StatusResourceBuild(self.status, build, control)
             else:
                 return NoResource("No such build '%d'" % num)
         return NoResource("really weird URL %s" % path)
 
 # $changes/NN
 class StatusResourceChanges(HtmlResource):
-    def __init__(self, changemaster):
+    def __init__(self, status, changemaster):
         HtmlResource.__init__(self)
+        self.status = status
         self.changemaster = changemaster
     def body(self, request):
         data = ""
@@ -1411,7 +1435,7 @@
         if path == "buildbot.css" and self.css:
             return static.File(self.css)
         if path == "changes":
-            return StatusResourceChanges(self.changemaster)
+            return StatusResourceChanges(self.status, self.changemaster)
         if path == "favicon.ico":
             if self.favicon:
                 return static.File(self.favicon)
@@ -1422,7 +1446,7 @@
             control = None
             if self.control:
                 control = self.control.getBuilder(path)
-            return StatusResourceBuilder(builder, control)
+            return StatusResourceBuilder(self.status, builder, control)
 
         return NoResource("No such Builder '%s'" % path)
 

Index: mail.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/mail.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mail.py	31 Aug 2005 08:04:36 -0000	1.19
+++ mail.py	19 Oct 2005 05:59:34 -0000	1.20
@@ -230,6 +230,9 @@
             text += "The Buildbot has detected a failed build of %s.\n" % name
         else:
             text += "The Buildbot has detected a new failure of %s.\n" % name
+        buildurl = self.status.getURLForThing(build)
+        if buildurl:
+            text += "Full details are available at: %s\n" % buildurl
         text += "\n"
 
         url = self.status.getBuildbotURL()

Index: words.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/words.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- words.py	14 Oct 2005 19:42:40 -0000	1.41
+++ words.py	19 Oct 2005 05:59:34 -0000	1.42
@@ -280,6 +280,9 @@
              results.get(b.getResults(), "??"))
         r += " [%s]" % " ".join(b.getText())
         self.reply(reply, r)
+        buildurl = self.status.getURLForThing(b)
+        if buildurl:
+            self.reply(reply, "Build details are at %s" % buildurl)
 
     def command_FORCE(self, user, reply, args):
         args = args.split(None, 2)





More information about the Commits mailing list