[151776] contrib/buildbot-test/master.cfg

mojca at macports.org mojca at macports.org
Sun Aug 21 15:47:55 PDT 2016


Revision: 151776
          https://trac.macports.org/changeset/151776
Author:   mojca at macports.org
Date:     2016-08-21 15:47:55 -0700 (Sun, 21 Aug 2016)
Log Message:
-----------
buildbot: move code around (put the old mail notifier class outside of loop)

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

Modified: contrib/buildbot-test/master.cfg
===================================================================
--- contrib/buildbot-test/master.cfg	2016-08-21 22:32:42 UTC (rev 151775)
+++ contrib/buildbot-test/master.cfg	2016-08-21 22:47:55 UTC (rev 151776)
@@ -499,6 +499,54 @@
     cancelPendingBuild = 'auth',
 )
 
+# TODO: This is the old mail notifier;
+# - useful functionality could be copied
+# - then the code should be removed
+#
+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()
+
+        # XXX: needs to be rewritten for the new steps of mp-buildbot
+        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])
+        
+        fakeAddresses = {'nomaintainer', 'nomaintainer at macports.org', 'openmaintainer', 'openmaintainer at macports.org'}
+        for p in failedPorts:
+            output = subprocess.Popen(['/opt/local/bin/port', 'info', '--index', '--maintainers', '--line', p], stdout=subprocess.PIPE).communicate()[0].strip()
+            for m in output.split(','):
+                if m not in fakeAddresses:
+                    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)
+
+        dl = []
+        for u in interestedUsers:
+            d = defer.maybeDeferred(self.lookup.getAddress, u)
+            dl.append(d)
+        return defer.gatherResults(dl)
+
 from buildbot.plugins import util
 
 def portWatcherMessageFormatter(mode, name, build, results, master_status):
@@ -589,55 +637,6 @@
         sendToInterestedUsers=False)
     # c['status'].append(mn)
 
-
-    # TODO: This is the old mail notifier;
-    # - useful functionality could be copied
-    # - then the code should be removed
-    #
-    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()
-
-            # XXX: needs to be rewritten for the new steps of mp-buildbot
-            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])
-            
-            fakeAddresses = {'nomaintainer', 'nomaintainer at macports.org', 'openmaintainer', 'openmaintainer at macports.org'}
-            for p in failedPorts:
-                output = subprocess.Popen(['/opt/local/bin/port', 'info', '--index', '--maintainers', '--line', p], stdout=subprocess.PIPE).communicate()[0].strip()
-                for m in output.split(','):
-                    if m not in fakeAddresses:
-                        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)
-
-            dl = []
-            for u in interestedUsers:
-                d = defer.maybeDeferred(self.lookup.getAddress, u)
-                dl.append(d)
-            return defer.gatherResults(dl)
-
 #    mn = PortsMailNotifier(fromaddr="noreply at macports.org", lookup="", relayhost="localhost",
 #        builders=ports_buildernames, mode="failing")
 #    c['status'].append(mn)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160821/68a54cdc/attachment.html>


More information about the macports-changes mailing list