Skip to content

Commit 26b1316

Browse files
committed
misc/fedora: various hacks to get the mass rebuilds working
1 parent 7a79358 commit 26b1316

File tree

2 files changed

+133
-9
lines changed

2 files changed

+133
-9
lines changed

misc/fedora/makeindex.py

Lines changed: 102 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def get_errors_from_file(htmlpath):
9898
# <tr><td>Function:</td> <td><b>init_gst</b></td></tr>
9999
# <tr><td>Error:</td> <td><b>ob_refcnt of new ref from (unknown) pygobject_init is 1 too high</b></td></tr>
100100
# </table>
101+
if not soup.html:
102+
# broken file: error during output of HTML?
103+
return
101104
for div in soup.html.body.findAll('div'):
102105
table = div.table
103106
if not table:
@@ -109,11 +112,15 @@ def get_second_col(row):
109112
return row('td')[1].b.string
110113
# Capture the marked up source code and notes from the report:
111114
htmlpre = div.div.pre
115+
116+
errmsg = get_second_col(rows[2])
117+
if not errmsg:
118+
continue
112119
yield ErrorReport(htmlpath=htmlpath,
113120
htmlid=div['id'],
114121
filename=get_second_col(rows[0]),
115122
function = get_second_col(rows[1]),
116-
errmsg = get_second_col(rows[2]),
123+
errmsg = errmsg,
117124
htmlpre = htmlpre)
118125

119126
class Severity(namedtuple('Severity', ('priority', 'title', 'description'))):
@@ -151,6 +158,14 @@ def _classify_segfault(self, report):
151158
description='<p>Code paths that will lead to a segmentatation fault</p>')
152159

153160
def classify(self, report):
161+
#print('report: %r' % (dir(report), ))
162+
#print('report.errmsg: %r' % report.errmsg)
163+
if report.errmsg is None:
164+
return Severity(priority=PRIORITY__UNCLASSIFIED,
165+
title='Unclassified errors',
166+
description='''
167+
<p>The triager didn't know how to classify these ones</p>
168+
''')
154169
m = re.match('ob_refcnt of (.+) too high', report.errmsg)
155170
if m:
156171
if report.might_be_borrowed_ref():
@@ -241,6 +256,8 @@ class BuildLog:
241256
def __init__(self, path):
242257
self.unimplemented_functions = set()
243258
self.cplusplus_failure = False
259+
self.seen_rpmbuild = False
260+
self.num_tracebacks = 0
244261

245262
buildlog = os.path.join(path, 'build.log')
246263
with open(buildlog) as f:
@@ -252,11 +269,54 @@ def __init__(self, path):
252269
if m:
253270
self.unimplemented_functions.add(m.group(1))
254271

255-
if "AttributeError: 'NoneType' object has no attribute 'vars'" in line:
256-
self.cplusplus_failure = True
272+
# Am seeing errors of this form:
273+
# The C++ compiler "/usr/bin/c++" is not able to compile a simple test
274+
# program.
275+
# It fails with the following output:
276+
# Change Dir: /builddir/build/BUILD/airrac-0.2.3/CMakeFiles/CMakeTmp
277+
#
278+
# Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
279+
# /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
280+
# CMakeFiles/cmTryCompileExec.dir/build
281+
# gmake[1]: Entering directory
282+
# `/builddir/build/BUILD/airrac-0.2.3/CMakeFiles/CMakeTmp'
283+
# /usr/bin/cmake -E cmake_progress_report
284+
# /builddir/build/BUILD/airrac-0.2.3/CMakeFiles/CMakeTmp/CMakeFiles 1
285+
# Building CXX object CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o
286+
# /usr/bin/c++ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
287+
# -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -o
288+
# CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o -c
289+
# /builddir/build/BUILD/airrac-0.2.3/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
290+
# Traceback (most recent call last):
291+
# File "/usr/bin/the-real-g++", line 53, in <module>
292+
# p = subprocess.Popen(args)
293+
# File "/usr/lib64/python2.7/subprocess.py", line 679, in __init__
294+
# errread, errwrite)
295+
# File "/usr/lib64/python2.7/subprocess.py", line 1130, in _execute_child
296+
# self.pid = os.fork()
297+
# OSError: [Errno 11] Resource temporarily unavailable
298+
if 'The C++ compiler "/usr/bin/c++" is not able to compile a simple test' in line:
299+
self.cplusplus_failure = 'The C++ compiler "/usr/bin/c++" is not able to compile a simple test'
300+
301+
if not self.cplusplus_failure:
302+
if 'OSError: [Errno 11] Resource temporarily unavailable' in line:
303+
self.cplusplus_failure = 'OSError: [Errno 11] Resource temporarily unavailable'
304+
305+
if 'configure: error: C++ compiler cannot create executables' in line:
306+
self.cplusplus_failure = 'configure: error: C++ compiler cannot create executables'
307+
308+
if 'rpmbuild -bb' in line:
309+
self.seen_rpmbuild = True
310+
311+
if line.startswith('Traceback '):
312+
self.num_tracebacks += 1
257313

258314
class Index:
259315
def __init__(self, path, title):
316+
self.reported = False
317+
self.seen_SWIG = False
318+
self.seen_Cython = False
319+
260320
outpath = os.path.join(path, 'index.html')
261321
with open(outpath, 'w') as f:
262322
f.write('<html><head><title>%s</title></head>\n' % title)
@@ -269,9 +329,18 @@ def __init__(self, path, title):
269329
buildlog = BuildLog(path)
270330

271331
if buildlog.cplusplus_failure:
272-
f.write(' <p>C++ failure</p>\n')
332+
f.write(' <p>C++ failure: %s</p>\n' % buildlog.cplusplus_failure)
273333
srpm = Srpm.from_path(path)
274-
BugReportDb.add_status(srpm, "FIXME: C++")
334+
BugReportDb.add_status(srpm, "FIXME: C++ failure: %s" % buildlog.cplusplus_failure)
335+
self.reported = True
336+
"""
337+
if not buildlog.seen_rpmbuild:
338+
f.write(' <p>Did not see rpmbuild -bb in build.log</p>\n')
339+
srpm = Srpm.from_path(path)
340+
BugReportDb.add_status(srpm, "FIXME: did not see rpmbuild -bb in build.log")
341+
self.reported = True
342+
return
343+
"""
275344

276345
# Gather the ErrorReport by severity
277346
triager = Triager()
@@ -287,6 +356,8 @@ def __init__(self, path, title):
287356
#print ' ', os.path.join(dirpath, filename)
288357
htmlpath = os.path.join(dirpath, filename)
289358
for er in get_errors_from_file(htmlpath):
359+
if er is None:
360+
continue
290361
#print(er.filename)
291362
#print(er.function)
292363
#print(er.errmsg)
@@ -310,6 +381,12 @@ def __init__(self, path, title):
310381
href, er.errmsg))
311382
f.write(' </table>\n')
312383

384+
if 'SWIG' in er.function or 'SWIG' in er.errmsg:
385+
self.seen_SWIG = True
386+
387+
if '__pyx' in er.function or '__pyx' in er.errmsg:
388+
self.seen_Cython = True
389+
313390
if buildlog.unimplemented_functions:
314391
f.write(' <h2>Implementation notes for gcc-with-cpychecker</h2>\n')
315392
f.write(' <p>The following "Py" functions were used but aren\'t\n'
@@ -325,6 +402,26 @@ def __init__(self, path, title):
325402
f.write(' </body>\n')
326403
f.write('</html>\n')
327404

405+
if self.seen_Cython:
406+
if not self.reported:
407+
srpm = Srpm.from_path(path)
408+
BugReportDb.add_status(srpm, "FIXME: Cython-built")
409+
self.reported = True
410+
411+
if self.seen_SWIG:
412+
if not self.reported:
413+
srpm = Srpm.from_path(path)
414+
BugReportDb.add_status(srpm, "FIXME: SWIG-built")
415+
self.reported = True
416+
417+
if buildlog.num_tracebacks >= 5:
418+
if not self.reported:
419+
srpm = Srpm.from_path(path)
420+
BugReportDb.add_status(srpm,
421+
("FIXME: %i tracebacks during build"
422+
% buildlog.num_tracebacks))
423+
self.reported = True
424+
328425
def iter_severities(self):
329426
for sev in sorted(self.severities.keys())[::-1]:
330427
yield sev, self.severities[sev]

misc/fedora/mass-rebuild.py

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ def run_mock(commands, captureOut=False, captureErr=False, failOnError=True):
164164
# Copy the file from the chroot to our result location:
165165
run_mock(['--copyout', line, dstPath])
166166

167-
PLUGIN_PATH='gcc-python2-plugin-0.9-1.fc16.x86_64.rpm'
167+
#PLUGIN_PATH='gcc-python2-plugin-0.9-1.fc16.x86_64.rpm'
168+
#PLUGIN_PATH='gcc-python2-plugin-0.9-1.with.git.stuff.fc16.a29cf4f671e566a7ee92cb3d604cc6ccfb25b781.x86_64.rpm'
169+
PLUGIN_PATH='gcc-python2-plugin-0.9-1.with.git.stuff.fc16.1e4eb81.x86_64.rpm'
168170
MOCK_CONFIG='fedora-16-x86_64'
169171

170172
def prepare_bug_report(srpmpath, index):
@@ -238,13 +240,14 @@ def prepare_bug_report(srpmpath, index):
238240

239241
# Rebuild all src.rpm files found in "SRPMS" as necessary:
240242
if 1:
243+
#unimplemented_functions = {}
241244
for srpmpath in sorted(glob.glob('SRPMS/*.src.rpm')):
242245
srpmname, version, release = nvr_from_srpm_path(srpmpath)
243246

244247
bugdb = BugReportDb()
245248
# print(bugdb.bugs)
246249
bugdb.print_summary()
247-
print('Processing %s' % srpmname)
250+
print('Processing %s' % srpmpath)
248251
statuses = bugdb.find(srpmname)
249252
if statuses:
250253
for status in statuses:
@@ -253,10 +256,34 @@ def prepare_bug_report(srpmpath, index):
253256

254257
resultdir = get_result_dir(srpmpath)
255258
if not os.path.exists(resultdir):
259+
continue #!
256260
local_rebuild_of_srpm_in_mock(srpmpath, MOCK_CONFIG)
261+
262+
from makeindex import BuildLog
263+
try:
264+
buildlog = BuildLog(resultdir)
265+
except IOError:
266+
continue
267+
#for fn in buildlog.unimplemented_functions:
268+
# if fn in unimplemented_functions:
269+
# unimplemented_functions[fn] += 1
270+
# else:
271+
# unimplemented_functions[fn] = 1
272+
273+
#continue
274+
257275
index = Index(resultdir, 'Errors seen in %s' % resultdir)
258-
prepare_bug_report(srpmpath, index)
259-
break
276+
if not index.reported:
277+
prepare_bug_report(srpmpath, index)
278+
break
279+
280+
if 0:
281+
from pprint import pprint
282+
pprint(unimplemented_functions)
283+
for key, value in sorted([(k, v) for (k, v) in unimplemented_functions.iteritems()],
284+
lambda (k1,v1), (k2, v2): cmp(v2, v1)):
285+
print key, value
286+
260287

261288
# TODO:
262289
# - automate grabbing the src.rpms; see e.g.:

0 commit comments

Comments
 (0)