summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_common.py
diff options
context:
space:
mode:
authorXimin Luo <infinity0@debian.org>2016-06-14 21:45:02 +0200
committerHolger Levsen <holger@layer-acht.org>2016-06-14 22:11:30 +0200
commitb323cdd195f68a607533d2c2e8f7209744edb3dc (patch)
tree6b3d5e03ebbccbc85773e540f29d0568f67f1b34 /bin/reproducible_common.py
parentb9d6c50b134d85fed96cd5a5c087253b01e7541d (diff)
downloadjenkins.debian.net-b323cdd195f68a607533d2c2e8f7209744edb3dc.tar.xz
reproducible debian: also decorate popular packages in per-issue pages
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_common.py')
-rwxr-xr-xbin/reproducible_common.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 661a81cd..3b42cabe 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -459,29 +459,33 @@ def package_has_notes(package):
return False
-def link_package(package, suite, arch, bugs={}):
+def link_package(package, suite, arch, bugs={}, popcon=None, is_popular=None):
url = RB_PKG_URI + '/' + suite + '/' + arch + '/' + package + '.html'
query = 'SELECT n.issues, n.bugs, n.comments ' + \
'FROM notes AS n JOIN sources AS s ON s.id=n.package_id ' + \
'WHERE s.name="{pkg}" AND s.suite="{suite}" ' + \
'AND s.architecture="{arch}"'
+ css_classes = []
+ if is_popular:
+ css_classes += ["package-popular"]
+ title = ''
+ if popcon is not None:
+ title += 'popcon score: ' + str(popcon) + '\n'
try:
notes = query_db(query.format(pkg=package, suite=suite, arch=arch))[0]
except IndexError: # no notes for this package
- html = '<a href="' + url + '" class="package">' + package + '</a>'
+ css_classes += ["package"]
else:
- title = ''
+ css_classes += ["noted"]
for issue in json.loads(notes[0]):
title += issue + '\n'
for bug in json.loads(notes[1]):
title += '#' + str(bug) + '\n'
if notes[2]:
title += notes[2]
- title = HTML.escape(title.strip())
- html = '<a href="' + url + '" class="noted" title="' + title + \
- '">' + package + '</a>'
- finally:
- html += get_trailing_icon(package, bugs) + '\n'
+ html = '<a href="' + url + '" class="' + ' '.join(css_classes) \
+ + '" title="' + HTML.escape(title.strip()) + '">' + package + '</a>' \
+ + get_trailing_icon(package, bugs) + '\n'
return html