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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
#!/usr/bin/env python
import pickle
import re
import os
import collections
import web
urls = (
'/helpers/patchtrack', 'patchtrack',
'/helpers/testlog/(.*)', 'testlog',
'/helpers/buildlog', 'buildlog',
'/helpers/tickets', 'tickets'
)
app = web.application(urls, globals())
render = web.template.render('templates/', base='layout')
def shorten(v):
if '. ' in v:
v = v[:v.index('. ')+1]
limit = 200
if len(v) > limit:
v = v[:limit] + '...'
return v
def load_db():
lp = pickle.load(open('lpcache.pickle', 'rb'))['lp']
bzr = pickle.load(open('bzrcache.pickle', 'rb'))
revision_map = {}
for name, db in bzr['branches'].items():
revisions = db['revisions']
for revision in revisions:
fqn = '%s,revno=%d' % (name, revision.revno)
print fqn
revision_map[fqn] = revision
revision.short = shorten(revision.message)
# Cross-reference
for revision in revisions:
revision.bugs = []
for revision in revisions:
for id in revision.fixes:
if id in lp.bugs:
revision.bugs.append(lp.bugs[id])
project = lp.projects['gcc-linaro']
for task in project.tasks:
for message in task.bug.messages:
for line in message.content.split('\n'):
match = re.match('fixed-in:\s+(.+)$', line)
if match:
revno = match.group(1)
if revno in revision_map:
revision_map[revno].bugs.append(task.bug)
elif revno.isdigit():
fqn = 'lp:gcc-linaro/4.4,revno=%s' % revno
print fqn
if fqn in revision_map:
revision_map[fqn].bugs.append(task.bug)
else:
assert False, 'Unrecogniesed revision %s on %s' % (revno, message.content)
for bug in lp.bugs.values():
bug.short = shorten(bug.title)
for item in lp.by_self_link.values():
item.lp_link = re.sub(r'(.+)\://api\.(.+)/1\.0/(.+)', r'\1://\2/\3', item.self_link)
db = {
'lp': lp,
'project': project,
'branches': bzr['branches']
}
return db
class patchtrack:
def GET(self):
db = load_db()
return render.index(db)
class Line:
def __init__(self, lineno, text, type, ticket=None):
self.lineno = lineno
self.text = text
self.type = type
self.ticket = ticket
ticketmap = {
'g++.dg/eh/pr42859.C': 602168,
'g++.dg/vect/pr36648.cc': 602186,
'gcc.dg/autopar/*': 602190,
'gcc.dg/Warray-bounds-3.c': 602277,
'gcc.dg/tree-ssa/predcom*': 602285,
'gcc.dg/vect/*': 602287,
'gcc.target/arm/vfp-ldmias.c': 602288,
'gcc.target/arm/vfp-stmias.c': 602288,
'gfortran.dg/vect/*': 602291,
'gcc.dg/tree-prof/*': 612402,
'gcc.c-torture/execute/990208-1.c': 612405,
'gcc.c-torture/execute/bcp-1.c': 612406,
}
def map_ticket(line):
match = re.match('[A-Z]+: (\S+)', line)
if match:
test = match.group(1)
for name, ticket in ticketmap.items():
if name.endswith('*'):
if test.startswith(name[:-1]):
return ticket
elif name == test:
return ticket
return None
class testlog:
def GET(self, log):
with open('/var/www/ex.seabright.co.nz/build/' + log) as f:
lines = f.readlines()
post = []
for i, line in enumerate(lines):
line = line.rstrip()
if 'FAIL:' in line:
type = 'fail'
elif 'Running ' in line:
type = 'note'
elif '=== ' in line:
type = 'header'
elif line.startswith('# of '):
type = 'note'
elif re.match('[A-Z]+: ', line):
type = 'mark'
else:
type = 'other'
post.append(Line(i+1, line, type, map_ticket(line)))
return render.testlog(log, post)
class buildlog:
def GET(self):
root = '/home/michaelh/c/tmp/ex/build/'
hosts = {}
builds = {}
cpus = {}
drop, dirnames, drop = os.walk(root).next()
for name in dirnames:
builds[name] = {}
drop, drop, filenames = os.walk(os.path.join(root, name)).next()
for fname in filenames:
if fname.endswith('.tar.gz'):
parts = fname.split('.')[-3].split('-')
if len(parts) > 4:
cpu, distro, ver, host = parts[-4:]
hosts[host] = cpu
cpus[cpu] = True
logs = '%s/logs/%s-%s-%s-%s' % (name, cpu, distro, ver, host)
languages = None
try:
with open(root + logs + '/gcc-configure.txt') as f:
for line in f.readlines():
line = line.strip()
if line.startswith('The following'):
print line
end = line.split(': ')[-1]
languages = end.split(',')
print languages
except Exception, ex:
print '!!', ex
builds[name][host] = {
'binary': '%s/%s' % (name, fname),
'logs': logs,
'testlog': None,
'languages': languages
}
# Fix up changes in path
if os.path.exists(os.path.join(root + logs, 'gcc-test.txt')):
builds[name][host]['testlog'] = logs + '/gcc-test.txt'
if os.path.exists(os.path.join(root + logs, 'gcc-testsuite.txt')):
builds[name][host]['testlog'] = logs + '/gcc-testsuite.txt'
helpers = {}
helpers['sorted'] = sorted
return render.buildlog(hosts, cpus, builds, helpers)
class tickets:
def GET(self):
helpers = {}
helpers['sorted'] = sorted
helpers['getattr'] = getattr
return render.tickets(load_db(), helpers, web.input().get('group_by', None))
if __name__ == "__main__":
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
app.run()
|