[84352] contrib/buildbot/master.cfg

jmr at macports.org jmr at macports.org
Fri Sep 23 07:28:06 PDT 2011


Revision: 84352
          http://trac.macports.org/changeset/84352
Author:   jmr at macports.org
Date:     2011-09-23 07:28:03 -0700 (Fri, 23 Sep 2011)
Log Message:
-----------
buildmaster: add email notification for port failures

Modified Paths:
--------------
    contrib/buildbot/master.cfg

Modified: contrib/buildbot/master.cfg
===================================================================
--- contrib/buildbot/master.cfg	2011-09-23 08:37:09 UTC (rev 84351)
+++ contrib/buildbot/master.cfg	2011-09-23 14:28:03 UTC (rev 84352)
@@ -321,6 +321,52 @@
         builders=base_buildernames, mode="problem")
     c['status'].append(mn)
 
+    import subprocess
+    from twisted.internet import defer
+    # notifier that sends mail to last committers and maintainers of failed ports
+    class PortsMailNotifier(MailNotifier):
+        # would make more sense to override getInterestedUsers() in BuildStatus,
+        # but it seems almost impossible to tell a builder to use a different
+        # class for status in its Build objects
+        def useLookup(self, build):
+            failedPorts = set()
+            interestedUsers = set()
+
+            statusStep = [x for x in build.getSteps() if x.getName() == "status"][0]
+            statusLog = [x for x in statusStep.getLogs() if x.getName() == "portstatus"][0]
+            for line in statusLog.getText().splitlines():
+                halves = line.split()
+                if halves[0] == "[FAIL]":
+                    failedPorts.add(halves[1])
+
+            for p in failedPorts:
+                output = subprocess.check_output(['port', 'info', '--index', '--maintainers', '--line', p])
+                for m in output.split(','):
+                    if m != "nomaintainer at macports.org" and m != "openmaintainer at macports.org":
+                        interestedUsers.add(m)
+
+            ss = build.getSourceStamp()
+            if ss:
+                for c in ss.changes:
+                    interesting = False
+                    for f in c.files:
+                        comps = f.split('/')
+                        if len(comps) >= 3 and comps[2] in failedPorts and comps[0] == 'dports' and comps[1] != '_resources':
+                            interesting = True
+                            break
+                    if interesting:
+                        interestedUsers.add(c.who)
+
+            for u in interestedUsers:
+                d = defer.maybeDeferred(self.lookup.getAddress, u)
+                d.addCallback(self.recipients.append)
+                self.dl.append(d)
+            return defer.DeferredList(self.dl)
+
+    mn = PortsMailNotifier(fromaddr="noreply at macports.org", lookup="", relayhost="mail.root.id.au",
+        builders=ports_buildernames, mode="failing")
+    c['status'].append(mn)
+
 ####### PROJECT IDENTITY
 
 # the 'title' string will appear at the top of this buildbot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110923/c6f80db7/attachment.html>


More information about the macports-changes mailing list