Removing raw string parameter from email message

This commit is contained in:
Sergio Durigan Junior 2014-12-26 16:13:25 -05:00
parent 88182289f5
commit 56bdb82ed1

View file

@ -118,43 +118,43 @@ def MessageGDBTesters (mode, name, build, results, master_status):
"""This function is responsible for composing the message that will be """This function is responsible for composing the message that will be
send to the gdb-testers mailing list.""" send to the gdb-testers mailing list."""
# Subject # Subject
subj = r"Failures on %s" % name subj = "Failures on %s" % name
# Body # Body
text = r"" text = ""
# Buildslave name, useful for knowing the exact configuration. # Buildslave name, useful for knowing the exact configuration.
text += r"Builder:\n" text += "Builder:\n"
text += r"\t%s\n" % build.getSlavename () text += "\t%s\n" % build.getSlavename ()
# Commits that were tested. Usually we should be dealing with # Commits that were tested. Usually we should be dealing with
# only one commit # only one commit
text += r"Commit(s) tested:\n" text += "Commit(s) tested:\n"
ss_list = build.getSourceStamps () ss_list = build.getSourceStamps ()
for ss in ss_list: for ss in ss_list:
text += r"\t%s\n" % ss.revision text += "\t%s\n" % ss.revision
# URL to find more info about what went wrong. # URL to find more info about what went wrong.
text += r"Log URL(s):\n" text += "Log URL(s):\n"
for ss in ss_list: for ss in ss_list:
text += r"\t<%sresults/%s/%s>\n" % (master_status.getBuildbotURL (), name, ss.revision) text += "\t<%sresults/%s/%s>\n" % (master_status.getBuildbotURL (), name, ss.revision)
# Who's to blame? # Who's to blame?
text += r"Author(s):\n" text += "Author(s):\n"
for author in build.getResponsibleUsers(): for author in build.getResponsibleUsers():
text += r"\t%s\n" % author text += "\t%s\n" % author
# Including the 'regressions' log. This is the 'diff' of what # Including the 'regressions' log. This is the 'diff' of what
# went wrong. # went wrong.
text += r"\n" text += "\n"
text += r"============================\n" text += "============================\n"
for log in build.getLogs (): for log in build.getLogs ():
if log.getName () == 'regressions': if log.getName () == 'regressions':
if not log.hasContents (): if not log.hasContents ():
# If the 'regressions' log has no content, it probably # If the 'regressions' log has no content, it probably
# means that the test failed because of a timeout or # means that the test failed because of a timeout or
# something. In this case, we just warn. # something. In this case, we just warn.
text += r"<< TESTING FAILED (probably timeout) >>\nPlease check the logs on the web\n" text += "<< TESTING FAILED (probably timeout) >>\nPlease check the logs on the web\n"
else: else:
text += log.getText () text += log.getText ()
break break
@ -162,24 +162,24 @@ send to the gdb-testers mailing list."""
# Including the 'xfail' log. It is important to say which tests # Including the 'xfail' log. It is important to say which tests
# we are ignoring. # we are ignoring.
xfail = os.path.join (gdb_web_base, name, r'xfail') xfail = os.path.join (gdb_web_base, name, 'xfail')
if os.path.exists (xfail): if os.path.exists (xfail):
text += r"\n" text += "\n"
text += r"Failures that are being ignored:\n\n" text += "Failures that are being ignored:\n\n"
with open (xfail, 'r') as f: with open (xfail, 'r') as f:
text += f.read () text += f.read ()
text += r"\n" text += "\n"
return { 'body' : text, return { 'body' : text,
'type' : r'plain', 'type' : 'plain',
'subject' : subj } 'subject' : subj }
from buildbot.status import mail from buildbot.status import mail
mn = mail.MailNotifier(fromaddr = r"sergiodj@redhat.com", mn = mail.MailNotifier(fromaddr = "sergiodj@redhat.com",
sendToInterestedUsers = False, sendToInterestedUsers = False,
extraRecipients = [r'sergiodj@redhat.com'], extraRecipients = ['sergiodj@redhat.com'],
# extraRecipients = ['gdb-testers@sourceware.org'], # extraRecipients = ['gdb-testers@sourceware.org'],
relayhost = r"smtp.corp.redhat.com", relayhost = "smtp.corp.redhat.com",
mode = (r'failing'), mode = ('failing'),
smtpPort = 25, smtpPort = 25,
messageFormatter = MessageGDBTesters, messageFormatter = MessageGDBTesters,
extraHeaders = { 'X-GDB-Buildbot' : '1' }) extraHeaders = { 'X-GDB-Buildbot' : '1' })