Fine-controlling when to report build breakages

This commit is contained in:
Sergio Durigan Junior 2015-06-10 21:09:36 -04:00
parent 9c7630560c
commit b27882c65c

View file

@ -177,10 +177,28 @@ 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."""
def make_breakage_lockfile_name (builder):
return "/tmp/gdb-buildbot-%s.lock" % builder
def SendAuthorMessage (name, change, text_prepend):
"""Send a message to the author of the commit if it broke GDB.
We use a lock file to avoid reporting the breakage to different
people. This may happen, for example, if a commit X breaks GDB, but
subsequent commits are made after X, by different people."""
global GDB_MAIL_FROM
lockfile = make_breakage_lockfile_name (name)
if os.path.exists (lockfile):
# This means we have already reported this failure for this
# builder to the author.
return
# This file will be cleaned the next time we run
# MessageGDBTesters, iff the build breakage has been fixed.
open (lockfile, 'w').close ()
rev = change.revision
to = change.who
title = change.comments.split ('\n')[0]
@ -263,8 +281,17 @@ 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
# report_build_breakage will be True if we see a build breakage,
# i.e., if the 'configure' or the 'compile' steps fail. In this
# case, we use this variable to know if we must report the
# breakage directly to the author.
report_build_breakage = False
# found_regressions will be True if the 'regressions' log is not
# empty.
found_regressions = False
for log in build.getLogs ():
st = log.getStep ()
if st.getResults ()[0] == FAILURE:
@ -280,7 +307,7 @@ send to the gdb-testers mailing list."""
text += "============================\n"
text += log.getText ()
text += "============================\n"
send_author_msg = True
report_build_breakage = True
break
elif n == 'compile gdb':
text += "*** Failed to compiled GDB. ***\n"
@ -293,7 +320,7 @@ send to the gdb-testers mailing list."""
else:
text += ct
text += "============================\n"
send_author_msg = True
report_build_breakage = True
break
elif n == 'make tags':
# We do not want to break here, because if this step
@ -330,8 +357,15 @@ send to the gdb-testers mailing list."""
text += "============================\n"
text += "\n"
if send_author_msg:
SendAuthorMessage (cur_change, text)
if report_build_breakage:
SendAuthorMessage (name, cur_change, text)
else:
# There is no build breakage anymore! Yay! Now, let's see if
# we need to clean up any lock file from previous breaks.
lockfile = make_breakage_lockfile_name (name)
if os.path.exists (lockfile):
# We need to clean the lockfile. Garbage-collect it here.
os.remove (lockfile)
return { 'body' : text,
'type' : 'plain',