def __init__(self, path, title): self.reported = False self.seen_SWIG = False self.seen_Cython = False outpath = os.path.join(path, 'index.html') with open(outpath, 'w') as f: f.write('<html><head><title>%s</title></head>\n' % title) f.write(' <body>\n') f.write(' <h1>%s</h1>\n' % title) f.write(" <p>This is a summary of errors seen when compiling with <a href='https://fedorahosted.org/gcc-python-plugin/'>an experimental static analysis tool</a></p>") f.write(' <p>Raw build logs can be seen <a href="build.log">here</a></p>\n') buildlog = BuildLog(path) if buildlog.cplusplus_failure: f.write(' <p>C++ failure: %s</p>\n' % buildlog.cplusplus_failure) srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, "FIXME: C++ failure: %s" % buildlog.cplusplus_failure) self.reported = True """ if not buildlog.seen_rpmbuild: f.write(' <p>Did not see rpmbuild -bb in build.log</p>\n') srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, "FIXME: did not see rpmbuild -bb in build.log") self.reported = True return """ # Gather the ErrorReport by severity triager = Triager() # mapping from Severity to list of ErrorReport self.severities = {} self.num_reports = 0 for dirpath, dirnames, filenames in os.walk(path): #print dirpath, dirnames, filenames for filename in filenames: if filename.endswith('-refcount-errors.html'): #print ' ', os.path.join(dirpath, filename) htmlpath = os.path.join(dirpath, filename) for er in get_errors_from_file(htmlpath): if er is None: continue #print(er.filename) #print(er.function) #print(er.errmsg) sev = triager.classify(er) #print(sev) if sev in self.severities: self.severities[sev].append(er) else: self.severities[sev] = [er] for sev, issues in self.iter_severities(): f.write(' <h2>%s</h2>\n' % sev.title) f.write(' %s\n' % sev.description) f.write(' <table>\n') for er in issues: self.num_reports += 1 href = os.path.relpath(er.href(), path) f.write(' <tr> <td><a href=%s>%s</a></td> <td><a href=%s>%s</a></td> <td><a href=%s>%s</a></td> </tr>' % (href, er.filename, href, er.function, href, er.errmsg)) f.write(' </table>\n') if 'SWIG' in er.function or 'SWIG' in er.errmsg: self.seen_SWIG = True if '__pyx' in er.function or '__pyx' in er.errmsg: self.seen_Cython = True if buildlog.unimplemented_functions: f.write(' <h2>Implementation notes for gcc-with-cpychecker</h2>\n') f.write(' <p>The following "Py" functions were used but aren\'t\n' ' yet explicitly handled by gcc-with-cpychecker</p>\n' ' <ul>\n') for fnname in sorted(buildlog.unimplemented_functions): f.write(' <li><pre>%s</pre></li>\n' % fnname) f.write(' </ul>\n') if self.num_reports == 0 and not buildlog.unimplemented_functions: f.write(' <p>Nothing was reported; did the plugin run correctly?\n') f.write(' </body>\n') f.write('</html>\n') if self.seen_Cython: if not self.reported: srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, "FIXME: Cython-built") self.reported = True if self.seen_SWIG: if not self.reported: srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, "FIXME: SWIG-built") self.reported = True if buildlog.num_tracebacks >= 5: if not self.reported: srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, ("FIXME: %i tracebacks during build" % buildlog.num_tracebacks)) self.reported = True
def __init__(self, path, title): self.reported = False self.seen_SWIG = False self.seen_Cython = False outpath = os.path.join(path, 'index.html') with open(outpath, 'w') as f: f.write('<html><head><title>%s</title></head>\n' % title) f.write(' <body>\n') f.write(' <h1>%s</h1>\n' % title) f.write( " <p>This is a summary of errors seen when compiling with <a href='https://fedorahosted.org/gcc-python-plugin/'>an experimental static analysis tool</a></p>" ) f.write( ' <p>Raw build logs can be seen <a href="build.log">here</a></p>\n' ) buildlog = BuildLog(path) if buildlog.cplusplus_failure: f.write(' <p>C++ failure: %s</p>\n' % buildlog.cplusplus_failure) srpm = Srpm.from_path(path) BugReportDb.add_status( srpm, "FIXME: C++ failure: %s" % buildlog.cplusplus_failure) self.reported = True """ if not buildlog.seen_rpmbuild: f.write(' <p>Did not see rpmbuild -bb in build.log</p>\n') srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, "FIXME: did not see rpmbuild -bb in build.log") self.reported = True return """ # Gather the ErrorReport by severity triager = Triager() # mapping from Severity to list of ErrorReport self.severities = {} self.num_reports = 0 for dirpath, dirnames, filenames in os.walk(path): #print dirpath, dirnames, filenames for filename in filenames: if filename.endswith('-refcount-errors.html'): #print ' ', os.path.join(dirpath, filename) htmlpath = os.path.join(dirpath, filename) for er in get_errors_from_file(htmlpath): if er is None: continue #print(er.filename) #print(er.function) #print(er.errmsg) sev = triager.classify(er) #print(sev) if sev in self.severities: self.severities[sev].append(er) else: self.severities[sev] = [er] for sev, issues in self.iter_severities(): f.write(' <h2>%s</h2>\n' % sev.title) f.write(' %s\n' % sev.description) f.write(' <table>\n') for er in issues: self.num_reports += 1 href = os.path.relpath(er.href(), path) f.write( ' <tr> <td><a href=%s>%s</a></td> <td><a href=%s>%s</a></td> <td><a href=%s>%s</a></td> </tr>' % (href, er.filename, href, er.function, href, er.errmsg)) f.write(' </table>\n') if 'SWIG' in er.function or 'SWIG' in er.errmsg: self.seen_SWIG = True if '__pyx' in er.function or '__pyx' in er.errmsg: self.seen_Cython = True if buildlog.unimplemented_functions: f.write( ' <h2>Implementation notes for gcc-with-cpychecker</h2>\n' ) f.write( ' <p>The following "Py" functions were used but aren\'t\n' ' yet explicitly handled by gcc-with-cpychecker</p>\n' ' <ul>\n') for fnname in sorted(buildlog.unimplemented_functions): f.write(' <li><pre>%s</pre></li>\n' % fnname) f.write(' </ul>\n') if self.num_reports == 0 and not buildlog.unimplemented_functions: f.write( ' <p>Nothing was reported; did the plugin run correctly?\n' ) f.write(' </body>\n') f.write('</html>\n') if self.seen_Cython: if not self.reported: srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, "FIXME: Cython-built") self.reported = True if self.seen_SWIG: if not self.reported: srpm = Srpm.from_path(path) BugReportDb.add_status(srpm, "FIXME: SWIG-built") self.reported = True if buildlog.num_tracebacks >= 5: if not self.reported: srpm = Srpm.from_path(path) BugReportDb.add_status( srpm, ("FIXME: %i tracebacks during build" % buildlog.num_tracebacks)) self.reported = True
version='rawhide', component=srpmname, summary=('Bugs found in %s-%s-%s using gcc-with-cpychecker' ' static analyzer' % (srpmname, version, release)), comment=comment, blocked=['cpychecker'], bug_file_loc=reporturl) bugurl = bug.make_url() webbrowser.open(bugurl) # Rebuild all src.rpm files found in "SRPMS" as necessary: if 1: for srpmpath in sorted(glob.glob('SRPMS/*.src.rpm')): srpmname, version, release = nvr_from_srpm_path(srpmpath) bugdb = BugReportDb() # print(bugdb.bugs) bugdb.print_summary() print('Processing %s' % srpmname) statuses = bugdb.find(srpmname) if statuses: for status in statuses: print(status.get_status()) continue resultdir = get_result_dir(srpmpath) if not os.path.exists(resultdir): local_rebuild_of_srpm_in_mock(srpmpath, MOCK_CONFIG) index = Index(resultdir, 'Errors seen in %s' % resultdir) prepare_bug_report(srpmpath, index) break
summary=('Bugs found in %s-%s-%s using gcc-with-cpychecker' ' static analyzer' % (srpmname, version, release)), comment=comment, blocked=['cpychecker'], bug_file_loc=reporturl) bugurl = bug.make_url() webbrowser.open(bugurl) # Rebuild all src.rpm files found in "SRPMS" as necessary: if 1: #unimplemented_functions = {} for srpmpath in sorted(glob.glob('SRPMS/*.src.rpm')): srpmname, version, release = nvr_from_srpm_path(srpmpath) bugdb = BugReportDb() # print(bugdb.bugs) bugdb.print_summary() print('Processing %s' % srpmpath) statuses = bugdb.find(srpmname) if statuses: for status in statuses: print(status.get_status()) continue resultdir = get_result_dir(srpmpath) if not os.path.exists(resultdir): continue #! local_rebuild_of_srpm_in_mock(srpmpath, MOCK_CONFIG) from makeindex import BuildLog