Send message to author if commit broke GDB

This commit is contained in:
Sergio Durigan Junior 2015-06-07 16:14:17 -04:00
parent 5c57fcedf7
commit 84d22d434d

View file

@ -177,6 +177,36 @@ def SendRootMessageGDBTesters (branch, change):
s.sendmail (GDB_MAIL_FROM, [ GDB_MAIL_TO ], mail.as_string ()) s.sendmail (GDB_MAIL_FROM, [ GDB_MAIL_TO ], mail.as_string ())
s.quit () s.quit ()
def SendAuthorMessage (change, text_prepend):
"""Send a message to the author of the commit if it broke GDB."""
global GDB_MAIL_FROM
rev = change.revision
to = change.who
title = change.comments.split ('\n')[0]
sbj = 'Your commit \'%s\' broke GDB' % title
text = "Hello there,\n\n"
text += "Your commit:\n\n"
text += "\t%s\n" % title
text += "\t%s\n\n" % rev
text += "broke GDB. Please fix it, or the GDB gods will get you.\n\n"
text += "You can find details of the breakage below.\n\n"
text += "Cheers,\n\n"
text += "Your GDB BuildBot.\n\n"
text += "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\n"
text += "\n" + text_prepend
mail = MIMEText (text)
mail['Subject'] = sbj
mail['From'] = GDB_MAIL_FROM
mail['To'] = to
s = smtplib.SMTP ('localhost')
s.sendmail (GDB_MAIL_FROM, [ to ], mail.as_string ())
s.quit ()
def MessageGDBTesters (mode, name, build, results, master_status): 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."""
@ -233,6 +263,7 @@ send to the gdb-testers mailing list."""
if isrebuild and isrebuild == 'yes': if isrebuild and isrebuild == 'yes':
text += "\n*** WARNING: This was a REBUILD request! ***\n" text += "\n*** WARNING: This was a REBUILD request! ***\n"
text += "*** The previous build (build #%s) MAY NOT BE the ancestor of the current build! ***\n\n" % properties.getProperty ('buildnumber') text += "*** The previous build (build #%s) MAY NOT BE the ancestor of the current build! ***\n\n" % properties.getProperty ('buildnumber')
send_author_msg = False
found_regressions = False found_regressions = False
for log in build.getLogs (): for log in build.getLogs ():
st = log.getStep () st = log.getStep ()
@ -249,6 +280,7 @@ send to the gdb-testers mailing list."""
text += "============================\n" text += "============================\n"
text += log.getText () text += log.getText ()
text += "============================\n" text += "============================\n"
send_author_msg = True
break break
elif n == 'compile gdb': elif n == 'compile gdb':
text += "*** Failed to compiled GDB. ***\n" text += "*** Failed to compiled GDB. ***\n"
@ -261,6 +293,7 @@ send to the gdb-testers mailing list."""
else: else:
text += ct text += ct
text += "============================\n" text += "============================\n"
send_author_msg = True
break break
elif n == 'make tags': elif n == 'make tags':
# We do not want to break here, because if this step # We do not want to break here, because if this step
@ -296,6 +329,10 @@ send to the gdb-testers mailing list."""
text += f.read () text += f.read ()
text += "============================\n" text += "============================\n"
text += "\n" text += "\n"
if send_author_msg:
SendAuthorMessage (cur_change, text)
return { 'body' : text, return { 'body' : text,
'type' : 'plain', 'type' : 'plain',
'subject' : subj } 'subject' : subj }