diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-06-22 11:19:08 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-07-05 17:24:55 +0200 |
commit | 8c46f64b57464ba35d0c86d4a9f69c7e912396ab (patch) | |
tree | 657504bb3ea69d381816e4f47ca18b5590731e7b /bin/reproducible_common.py | |
parent | 658ffb103ece627fc8e924ba3cefe81aa55d24cc (diff) | |
download | jenkins.debian.net-8c46f64b57464ba35d0c86d4a9f69c7e912396ab.tar.xz |
reproducible debian: move python 'gen_status_link_icon' function to common
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_common.py')
-rwxr-xr-x | bin/reproducible_common.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index cc69c95a..7548a937 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -20,6 +20,7 @@ import atexit import sqlite3 import logging import argparse +import pystache import psycopg2 import html as HTML from string import Template @@ -138,6 +139,11 @@ if args.ignore_missing_files: tab = ' ' +# Templates used for creating package pages +renderer = pystache.Renderer(); +status_icon_link_template = renderer.load_template( + TEMPLATE_PATH + '/status_icon_link') + html_header = Template("""<!DOCTYPE html> <html> <head> @@ -529,6 +535,25 @@ def get_status_icon(status): return (status, '', spokenstatus) +def gen_status_link_icon(status, spokenstatus, icon, suite, arch): + """ + Returns the html for "<icon> <spokenstatus>" with both icon and status + linked to the appropriate index page for the status, arch and suite. + + If icon is set to None, the icon will be ommited. + If spokenstatus is set to None, the spokenstatus link be ommited. + """ + context = { + 'status': status, + 'spokenstatus': spokenstatus, + 'icon': icon, + 'suite': suite, + 'arch': arch, + 'untested': True if status == 'untested' else False, + } + return renderer.render(status_icon_link_template, context) + + def strip_epoch(version): """ Stip the epoch out of the version string. Some file (e.g. buildlogs, debs) |