[Qa-jenkins-scm] [jenkins.debian.net] 01/02: reproducible debian: Have index_issues also show total popcon scores of each issue
Holger Levsen
holger at layer-acht.org
Sat Jun 11 11:27:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit 91bacda06f3c535f5fbd79ea0bc1a226c93b1b5f
Author: Ximin Luo <infinity0 at debian.org>
Date: Wed May 11 04:11:21 2016 +0200
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 at layer-acht.org>
---
bin/reproducible_html_notes.py | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py
index 15f6068..a0e8a03 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])
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list