Change count to str

This commit is contained in:
Sergio Durigan Junior 2017-09-05 10:44:38 -04:00
parent d750aad632
commit 49294d746b

View file

@ -144,11 +144,11 @@ from email.mime.text import MIMEText
def SendRootMessageGDBTesters (branch, change, rev, def SendRootMessageGDBTesters (branch, change, rev,
istrysched = False, istrysched = False,
try_to = None, try_to = None,
try_count = 0): try_count = "0"):
global GDB_MAIL_TO, GDB_MAIL_FROM global GDB_MAIL_TO, GDB_MAIL_FROM
if istrysched: if istrysched:
f = "/tmp/gdb-buildbot-%s-try-%d.lock" % (rev, try_count) f = "/tmp/gdb-buildbot-%s-try-%s.lock" % (rev, try_count)
else: else:
f = "/tmp/gdb-buildbot-%s.lock" % rev f = "/tmp/gdb-buildbot-%s.lock" % rev
@ -174,17 +174,17 @@ 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 #%d ***\n\n" % try_count text += "*** TEST RESULTS FOR TRY BUILD #%s ***\n\n" % try_count
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 %d tries before this one.\n\n" % try_count 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 #%d against commit %s" % (try_count, rev) chg_title = "Try Build #%s against commit %s" % (try_count, rev)
text = text.encode ('ascii', 'ignore').decode ('ascii') text = text.encode ('ascii', 'ignore').decode ('ascii')
mail = MIMEText (text) mail = MIMEText (text)
@ -449,7 +449,7 @@ send to the gdb-testers mailing list."""
try_count = try_count) try_count = try_count)
# Subject # Subject
subj = "Try Build #%d on %s, branch %s" % (try_count, name, branch) subj = "Try Build #%s on %s, branch %s" % (try_count, name, branch)
# Body # Body
text = "" text = ""
@ -469,7 +469,7 @@ send to the gdb-testers mailing list."""
# URL to find more info about what went wrong. # URL to find more info about what went wrong.
text += "\nTestsuite log (gdb.sum and gdb.log) URL(s):\n" text += "\nTestsuite log (gdb.sum and gdb.log) URL(s):\n"
text += "\t<%s/%s/try/%s/%s/%d/>\n\n" % (res_url, name, sourcestamp.revision[:2], text += "\t<%s/%s/try/%s/%s/%s/>\n\n" % (res_url, name, sourcestamp.revision[:2],
sourcestamp.revision, try_count) sourcestamp.revision, try_count)
# commit_id = get_builder_commit_id (name, sourcestamp.revision, # commit_id = get_builder_commit_id (name, sourcestamp.revision,
@ -797,7 +797,7 @@ class ComputeTryBuildCount (steps.BuildStep):
con = sqlite3.connect (db_file) con = sqlite3.connect (db_file)
c = con.cursor () c = con.cursor ()
c.execute ('SELECT COUNT(*) FROM logs WHERE commitid = "%s" AND branch = "%s" AND trysched = 1' % (rev, branch)) c.execute ('SELECT COUNT(*) FROM logs WHERE commitid = "%s" AND branch = "%s" AND trysched = 1' % (rev, branch))
count = c.fetchone ()[0] count = str (c.fetchone ()[0])
con.close () con.close ()
self.setProperty ('try_count', count, 'ComputeTryBuildCount') self.setProperty ('try_count', count, 'ComputeTryBuildCount')