Simplifying Message-Id and In-Reply-To of root message

This commit is contained in:
Sergio Durigan Junior 2017-09-05 13:33:32 -04:00
parent ac777d5d8c
commit e7305810d2

View file

@ -141,6 +141,9 @@ import smtplib
import socket import socket
from email.mime.text import MIMEText from email.mime.text import MIMEText
def make_try_build_lockfile_name (rev):
return "/tmp/gdb-buildbot-%s-try.lock" % rev
def SendRootMessageGDBTesters (branch, change, rev, def SendRootMessageGDBTesters (branch, change, rev,
istrysched = False, istrysched = False,
try_to = None, try_to = None,
@ -148,7 +151,7 @@ def SendRootMessageGDBTesters (branch, change, rev,
global GDB_MAIL_TO, GDB_MAIL_FROM global GDB_MAIL_TO, GDB_MAIL_FROM
if istrysched: if istrysched:
f = "/tmp/gdb-buildbot-%s-try-%s.lock" % (rev, try_count) f = make_try_build_lockfile_name (rev)
else: else:
f = "/tmp/gdb-buildbot-%s.lock" % rev f = "/tmp/gdb-buildbot-%s.lock" % rev
@ -174,17 +177,15 @@ def SendRootMessageGDBTesters (branch, change, rev,
text = text.encode ('ascii', 'ignore').decode ('ascii') text = text.encode ('ascii', 'ignore').decode ('ascii')
else: else:
text = "" text = ""
text += "*** TEST RESULTS FOR TRY BUILD #%s ***\n\n" % try_count text += "*** TEST RESULTS FOR TRY BUILD ***\n\n"
text += "Branch: %s\n" % branch text += "Branch: %s\n" % branch
text += "Commit tested against: %s\n\n" % rev text += "Commit tested against: %s\n\n" % rev
text += "There have been %s tries before this one.\n\n" % try_count
text += "Patch tested:\n\n" text += "Patch tested:\n\n"
text += change text += change
chg_title = "Try Build #%s against commit %s" % (try_count, rev) chg_title = "Try Build against commit %s" % rev
text = text.encode ('ascii', 'ignore').decode ('ascii') text = text.encode ('ascii', 'ignore').decode ('ascii')
mail = MIMEText (text) mail = MIMEText (text)
@ -202,7 +203,7 @@ def SendRootMessageGDBTesters (branch, change, rev,
else: else:
mail['To'] = try_to mail['To'] = try_to
mailto = try_to mailto = try_to
mail['Message-Id'] = "<%s-try-%s@gdb-build>" % (rev, try_count) mail['Message-Id'] = "<%s-try@gdb-build>" % rev
s = smtplib.SMTP ('localhost') s = smtplib.SMTP ('localhost')
s.sendmail (GDB_MAIL_FROM, [ mailto ], mail.as_string ()) s.sendmail (GDB_MAIL_FROM, [ mailto ], mail.as_string ())
@ -604,7 +605,7 @@ mn_try = MyMailNotifier(fromaddr = GDB_MAIL_FROM,
lookup = LookupEmailTryBuild (), lookup = LookupEmailTryBuild (),
tags = [ "MAIL", "TRY" ], tags = [ "MAIL", "TRY" ],
extraHeaders = { 'X-GDB-Buildbot' : '1', extraHeaders = { 'X-GDB-Buildbot' : '1',
'In-Reply-To' : util.Interpolate ("<%(prop:got_revision)s-try-$(prop:try_count)s@gdb-build>")}) 'In-Reply-To' : util.Interpolate ("<%(prop:got_revision)s-try@gdb-build>")})
c['status'].append (mn) c['status'].append (mn)
c['status'].append (mn_try) c['status'].append (mn_try)