From 84d22d434d9e4345a3080d330f6e5bd05b092e0f Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Sun, 7 Jun 2015 16:14:17 -0400 Subject: [PATCH] Send message to author if commit broke GDB --- master.cfg | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/master.cfg b/master.cfg index a5fb4c2..f772912 100644 --- a/master.cfg +++ b/master.cfg @@ -177,6 +177,36 @@ def SendRootMessageGDBTesters (branch, change): s.sendmail (GDB_MAIL_FROM, [ GDB_MAIL_TO ], mail.as_string ()) 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): """This function is responsible for composing the message that will be send to the gdb-testers mailing list.""" @@ -233,6 +263,7 @@ send to the gdb-testers mailing list.""" if isrebuild and isrebuild == 'yes': 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') + send_author_msg = False found_regressions = False for log in build.getLogs (): st = log.getStep () @@ -249,6 +280,7 @@ send to the gdb-testers mailing list.""" text += "============================\n" text += log.getText () text += "============================\n" + send_author_msg = True break elif n == 'compile gdb': text += "*** Failed to compiled GDB. ***\n" @@ -261,6 +293,7 @@ send to the gdb-testers mailing list.""" else: text += ct text += "============================\n" + send_author_msg = True break elif n == 'make tags': # 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 += "============================\n" text += "\n" + + if send_author_msg: + SendAuthorMessage (cur_change, text) + return { 'body' : text, 'type' : 'plain', 'subject' : subj }