This repository has been archived by the owner on Jun 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
generators.py
96 lines (84 loc) · 3.22 KB
/
generators.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import re
import os.path
def buildTryCompleteMessage(attrs, packageDir, tinderboxTree):
platform = ''
task = ''
got_revision = ''
who = ''
builder = attrs['builderName']
try:
got_revision = attrs['buildProperties']['got_revision']
except KeyError:
try:
got_revision = attrs['buildProperties']['revision']
except KeyError:
got_revision = 'revision-not-set'
try:
who = attrs['buildProperties']['who']
except KeyError:
who = 'who-not-set'
if 'Linux x86-64' in builder:
platform = 'linux64'
elif 'Linux' in builder:
platform = 'linux'
elif 'OS X 10.6' in builder:
platform = 'mac64'
elif 'OS X 10.5' in builder:
platform = 'mac'
elif 'WINNT' in builder:
platform = 'win32'
elif 'Maemo' in builder:
platform = 'maemo'
if 'test' in builder:
task = 'test'
elif 'talos' in builder:
task = 'talos'
else:
task = 'build'
url = packageDir % locals()
if attrs['result'] == 'success':
text = """\
Your Try Server %(task)s (%(got_revision)s) was successfully completed on \
%(platform)s on builder: %(builder)s.\n\n""" % locals()
elif attrs['result'] == 'warnings':
text = """\
Your Try Server %(task)s (%(got_revision)s) completed with warnings on \
%(platform)s on builder: %(builder)s.\n\n""" % locals()
elif attrs['result'] == 'exception':
text = """\
Your Try Server %(task)s (%(got_revision)s) hit an exception on \
%(platform)s on builder: %(builder)s.\n\n""" % locals()
elif attrs['result'] == 'failure':
text = """\
Your Try Server %(task)s (%(got_revision)s) failed to complete on \
%(platform)s on builder: %(builder)s.\n\n""" % locals()
else:
text = """\
Unknown issues arose during %(task)s (%(got_revision)s) on \
%(platform)s on builder: %(builder)s. Check with RelEng if you have questions.\n\n""" % locals()
if attrs['result'] in ('success', 'warnings') and packageDir and 'who-not-set' not in who:
text += "It should be available for download at %(url)s\n\n" % locals()
if attrs['result'] in ('failure', 'exception') and 'who-not-set' not in who:
text += "While some of the build steps haven't succeeded, your build package might have been \
successfully created and could be available for download at %(url)s\n\n" % locals()
if task == 'test':
text += "Summary of test results:\n"
for log in attrs['logs']:
if 'summary' not in log[0]:
continue
summary = ''.join(log[2]).replace('TinderboxPrint: ', '')
summary = summary.replace('<br/>', ': ')
text += '%s\n' % summary
text += '\n'
elif task == 'talos':
text += "Summary of talos results:\n"
for log in attrs['logs']:
if 'summary' not in log[0]:
continue
for line in log[2]:
test = re.search("(\w+): ([0-9.:]+)", line)
if test:
text += "%s\n" % (test.group(0))
text += '\n'
text += """Visit http://tinderbox.mozilla.org/showbuilds.cgi?tree=%(tinderboxTree)s to view the full logs.""" % locals()
return (text, 'plain')