Implementing mail lookup for names

This commit is contained in:
Sergio Durigan Junior 2016-07-26 13:41:22 -04:00
parent 477ef8b85d
commit 369cd7753f

View file

@ -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>",