summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_html_notes.py
diff options
context:
space:
mode:
authorXimin Luo <infinity0@debian.org>2016-05-11 04:11:21 +0200
committerHolger Levsen <holger@layer-acht.org>2016-06-11 13:24:38 +0200
commit91bacda06f3c535f5fbd79ea0bc1a226c93b1b5f (patch)
tree339e6c97ad85984956b9b57308cee0bff81d27b3 /bin/reproducible_html_notes.py
parent43f05710a5046930e5b201e0c1635acdec86ab45 (diff)
downloadjenkins.debian.net-91bacda06f3c535f5fbd79ea0bc1a226c93b1b5f.tar.xz
reproducible debian: Have index_issues also show total popcon scores of each issue
We add extra columns in the table, that indicate: 1. the total popcon of each issue's packages 2. the total sqrt-popcon of that 3. the count of that, as before We also change the default sort order to be (1) instead of (3) as before. Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_html_notes.py')
-rwxr-xr-xbin/reproducible_html_notes.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py
index 15f6068a..a0e8a030 100755
--- a/bin/reproducible_html_notes.py
+++ b/bin/reproducible_html_notes.py
@@ -11,7 +11,9 @@
# Build html pages based on the content of the notes.git repository
import copy
+import popcon
import yaml
+from math import sqrt
from reproducible_common import *
from reproducible_html_packages import gen_packages_html
from reproducible_html_indexes import build_page
@@ -224,10 +226,7 @@ def gen_html_note(package, note):
tmp = ''
for issue in note['issues']:
tmp += fill_issue_in_note(issue)
- try:
- issues_count[issue].append(note['package'])
- except KeyError:
- issues_count[issue] = [note['package']]
+ issues_count.setdefault(issue, []).append(note['package'])
infos += note_issues_html.substitute(issues=tmp)
# check for bugs:
if 'bugs' in note:
@@ -387,27 +386,30 @@ def iterate_over_issues(issues):
log.info('Created ' + str(i) + ' issue pages for ' + suite)
-def sort_issues(issue):
+def sort_issues(scorefunc, issue):
try:
- return (-len(issues_count[issue]), issue)
+ return (-scorefunc(issues_count[issue]), issue)
except KeyError: # there are no packages affected by this issue
return (0, issue)
-def index_issues(issues):
+def index_issues(issues, scorefuncs):
+ firstscorefunc = next(iter(scorefuncs.values()))
templ = "\n<table class=\"body\">\n" + tab + "<tr>\n" + tab*2 + "<th>\n" \
+ tab*3 + "Identified issues\n" + tab*2 + "</th>\n" + tab*2 + "<th>\n" \
+ + "".join(
+ tab*3 + k + "\n" + tab*2 + "</th>\n" + tab*2 + "<th>\n"
+ for k in scorefuncs.keys()) \
+ tab*3 + "Affected packages\n" + tab*2 + "</th>\n" + tab + "</tr>\n"
html = (tab*2).join(templ.splitlines(True))
- for issue in sorted(issues, key=sort_issues):
+ for issue in sorted(issues, key=lambda issue: sort_issues(firstscorefunc, issue)):
html += tab*3 + '<tr>\n'
html += tab*4 + '<td><a href="' + ISSUES_URI + '/' + defaultsuite + \
'/'+ issue + '_issue.html">' + issue + '</a></td>\n'
+ issues_list = issues_count.get(issue, [])
+ for scorefunc in scorefuncs.values():
+ html += tab*4 + '<td><b>' + str(scorefunc(issues_list)) + '</b></td>\n'
html += tab*4 + '<td>\n'
- try:
- html += tab*5 + '<b>' + str(len(issues_count[issue])) + '</b>:\n'
- html += tab*5 + ', '.join(issues_count[issue]) + '\n'
- except KeyError: # there are no packages affected by this issue
- html += tab*5 + '<b>0</b>\n'
+ html += tab*5 + ', '.join(issues_list) + '\n'
html += tab*4 + '</td>\n'
html += tab*3 + '</tr>\n'
html += tab*2 + '</table>\n'
@@ -433,7 +435,11 @@ if __name__ == '__main__':
issues = load_issues()
iterate_over_notes(notes)
iterate_over_issues(issues)
- index_issues(issues)
+ index_issues(issues, {
+ 'Total popcon score': lambda l: sum(popcon.package(*l).values()),
+ 'Total of sqrt(popcon score)': lambda l: sum(map(sqrt, popcon.package(*l).values())),
+ 'Total number': len,
+ })
purge_old_notes(notes)
purge_old_issues(issues)
gen_packages_html([Package(x) for x in notes])