From 9c2d8201530f69716f0a703ea86d30af07823fbf Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 13 Mar 2015 16:09:04 +0100 Subject: reproducible: refactor, split packages shown into states --- bin/reproducible_html_notes.py | 43 ++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py index 06c24ec7..df0c1f01 100755 --- a/bin/reproducible_html_notes.py +++ b/bin/reproducible_html_notes.py @@ -241,11 +241,22 @@ def gen_html_issue(issue): # add affected packages: affected = '' try: - affected += tab*4 + '' + str(len(issues_count[issue])) + ':\n' - for pkg in sorted(issues_count[issue]): - # FIXME we currently consider notes only for sid/amd64 - affected += (tab*7 + '%s\n') % (RB_PKG_URI, pkg, pkg) + suite = 'sid' + arch = 'amd64' + for status in ['unreproducible', 'FTBFS', 'not for us', 'blacklisted', 'reproducible']: + pkgs = [x[0] for x in all_pkgs if x[1] == status and x[2] == suite and x[3] == arch and x[0] in issues_count[issue]] + if not pkgs: + continue + affected += tab*4 + '

\n' + affected += tab*5 + '\n' + affected += tab*5 + str(len(pkgs)) + ' ' + status + ' packages in ' + suite + '/' + arch +':\n' + affected += tab*5 + '\n' + for pkg in pkgs: + affected += tab*6 + '' + pkg + affected += '' + get_trailing_icon(pkg, bugs) + '\n' + affected += tab*5 + '\n' + affected += tab*4 + '

\n' except KeyError: # The note is not listed in any package, that is affected = 'None' # check for description: @@ -359,10 +370,9 @@ def index_issues(issues): def index_notes(notes, bugs): log.debug('Building the index_notes page...') - all_pkgs = query_db('SELECT s.name, r.status ' + - 'FROM results AS r JOIN sources AS s ON r.package_id=s.id ' + - 'ORDER BY s.name') - with_notes = [x for x in all_pkgs if x[0] in notes] + suite = 'sid' + arch = 'amd64' + with_notes = [x for x in all_pkgs if x[2] == suite and x[3] == arch and x[0] in notes] html = '\n

There are ' + str(len(notes)) + ' packages with notes.

\n' for status in ['unreproducible', 'FTBFS', 'not for us', 'blacklisted', 'reproducible']: pkgs = [x[0] for x in with_notes if x[1] == status] @@ -371,12 +381,10 @@ def index_notes(notes, bugs): html += '

\n' html += tab + '\n' - pkgs = [x[0] for x in with_notes if x[1] == status] - html += tab + str(len(pkgs)) + ' ' + status + ' packages:\n' + html += tab + str(len(pkgs)) + ' ' + status + ' packages in ' + suite + '/' + arch + ':\n' html += tab + '\n' - for pkg in pkgs: - # FIXME for now always link to the sid/amd64 url of a package - url = RB_PKG_URI + '/sid/amd64/' + pkg + '.html' + for pkg in sorted(pkgs): + url = RB_PKG_URI + '/' + suite + '/' + arch + '/' + pkg + '.html' html += tab*2 + '' + pkg html += '' + get_trailing_icon(pkg, bugs) + '\n' html += tab + '\n' @@ -414,11 +422,11 @@ def index_no_notes_section(notes, bugs, packages, suite, arch): def index_no_notes(notes, bugs): log.debug('Building the index_no_notes page...') - all_pkgs = query_db('SELECT s.name, s.suite, s.architecture, r.status ' + + all_bad_pkgs = query_db('SELECT s.name, s.suite, s.architecture, r.status ' + 'FROM results AS r JOIN sources AS s ON r.package_id=s.id ' + 'WHERE r.status = "unreproducible" OR r.status = "FTBFS"' + 'ORDER BY r.build_date DESC') - without_notes = [x for x in all_pkgs if x[0] not in notes] + without_notes = [x for x in all_bad_pkgs if x[0] not in notes] html = '\n

There are ' + str(len(without_notes)) + ' unreproducible ' \ + 'packages without notes, in all suites. These are the packages ' \ + 'with failures that still need to be investigated.

\n' @@ -437,6 +445,9 @@ def index_no_notes(notes, bugs): if __name__ == '__main__': + all_pkgs = query_db('SELECT s.name, r.status, s.suite, s.architecture ' + + 'FROM results AS r JOIN sources AS s ON r.package_id=s.id ' + + 'ORDER BY s.name') issues_count = {} bugs = get_bugs() notes = load_notes() -- cgit v1.2.3-54-g00ecf