From 369cd7753f6f6b6beba3edaae0ce62152a9ea0e8 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Tue, 26 Jul 2016 13:41:22 -0400 Subject: [PATCH] Implementing mail lookup for names --- master.cfg | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/master.cfg b/master.cfg index 413bfa4..0c3eef3 100644 --- a/master.cfg +++ b/master.cfg @@ -463,7 +463,7 @@ send to the gdb-testers mailing list.""" n = st.getName () if st.getResults ()[0] == SUCCESS or st.getResults ()[0] == WARNINGS: if n == 'regressions': - text += "Congratulations! No regressions were found in this build!\n\n" + text += "\nCongratulations! No regressions were found in this build!\n\n" break if st.getResults ()[0] == FAILURE: if 'No space left on device' in log.getText (): @@ -549,7 +549,6 @@ scheduler.""" # This means we're dealing with mn. We only send # e-mail on mn_try. return False - self.extraRecipients = [ build.getReason ().strip ("'try' job by user ") ] else: if "TRY" in self.tags: # We're dealing with mn_try. @@ -566,9 +565,27 @@ mn = MyMailNotifier(fromaddr = GDB_MAIL_FROM, 'In-Reply-To' : WithProperties ("<%s@gdb-build>", 'got_revision') }) +class MyLookupEmail (object): + implements (interfaces.IEmailLookup) + + def getAddress (self, name): + # List of [ dir, sorted_reverse ] + tryjobdir = [ [ os.path.expanduser ("~/gdb/try_ssh_jobdir/new/"), False ], + [ os.path.expanduser ("~/gdb/try_ssh_jobdir/cur/"), True ] ] + name_re = re.compile ("(%s <.*@.*>),.*" % name, flags = re.UNICODE) + for directory, sort_order in tryjobdir: + for _, _, filenames in os.walk (directory): + for f in sorted (filenames, reverse = sort_order): + with open (f, 'r') as myf: + for line in reversed (myf.readlines ()): + m = re.match (name_re, line) + if m: + return m.group (1) + mn_try = MyMailNotifier(fromaddr = GDB_MAIL_FROM, mode = ( 'failing', 'passing', 'warnings' ), messageFormatter = MessageGDBTestersTryBuild, + lookup = MyLookupEmail, tags = [ "MAIL", "TRY" ], extraHeaders = { 'X-GDB-Buildbot' : '1', 'In-Reply-To' : WithProperties ("<%s-try@gdb-build>",