From f4c68f1d927c2aabaf73014b02c81f2067161628 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sun, 4 Oct 2015 01:43:06 +0200 Subject: reproducible: refactor and fix status icons for all stati --- bin/reproducible_common.py | 5 +++-- bin/reproducible_html_packages.py | 29 ++++++++++++----------------- 2 files changed, 15 insertions(+), 19 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index f621beaa..fcb35f02 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -436,15 +436,16 @@ def get_status_icon(status): 'not_for_us': 'weather-few-clouds-night.png', 'untested': 'weather-clear-night.png', 'blacklisted': 'error.png'} + spokenstatus = status if status == 'unreproducible': status = 'FTBR' elif status == 'not for us': status = 'not_for_us' try: - return (status, table[status]) + return (status, table[status], spokenstatus) except KeyError: log.error('Status ' + status + ' not recognized') - return (status, '') + return (status, '', spokenstatus) def strip_epoch(version): """ diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index a5875b75..3c078eb5 100755 --- a/bin/reproducible_html_packages.py +++ b/bin/reproducible_html_packages.py @@ -69,13 +69,7 @@ def sizeof_fmt(num): return str(int(round(float("%f" % num), 0))) + "%s" % ('Yi') -def gen_status_link_icon(status, icon, suite, arch): - if status == 'not_for_us': - spokenstatus = 'not for us' - elif status == 'FTBR': - spokenstatus = 'unreproducible' - else: - spokenstatus = status +def gen_status_link_icon(status, spokenstatus, icon, suite, arch): html = """ {spokenstatus} @@ -86,7 +80,7 @@ def gen_status_link_icon(status, icon, suite, arch): # There are no indices for untested packages if status == 'untested': - html = '{status} {status}' + html = '{spokenstatus} {spokenstatus}' return html.format(status=status, spokenstatus=spokenstatus, icon=icon, suite=suite, arch=arch) @@ -184,6 +178,7 @@ def gen_suites_links(package, current_suite, current_arch): continue version = package.get_tested_version(s, a) build_date = package.get_build_date(s, a) + status, icon, spokenstatus = get_status_icon(status) if build_date and status != 'blacklisted': build_date = ' on ' + build_date else: @@ -192,17 +187,17 @@ def gen_suites_links(package, current_suite, current_arch): if s == current_suite and a == current_arch: li_classes.append('active') html += '
  • \n' + tab - if s != current_suite or a != current_arch or status != 'untested': - prefix = ''.format(s, a, status) - suffix = '\n' - else: + if ( s == current_suite and a == current_arch ) or status == 'untested': prefix = '' suffix = '\n' - icon = prefix + '{status}' + suffix - html += icon.format(icon=get_status_icon(status)[1], status=status) + else: + prefix = ''.format(s, a, status) + suffix = '\n' + icon_html = prefix + '{spokenstatus}' + suffix + html += icon_html.format(icon=icon, status=status, spokenstatus=spokenstatus) html += (tab*2 + ' {} in {}\n').format(RB_PKG_URI, - s, a, package.name, status, version, build_date, version, s, a, s) + s, a, package.name, spokenstatus, version, build_date, version, s, a, s) html += '
  • \n' html += tab + '' html += '\n' @@ -238,8 +233,8 @@ def gen_packages_html(packages, no_clean=False): links, default_view = gen_extra_links( pkg, version, suite, arch, status) suites_links = gen_suites_links(package, suite, arch) - status, icon = get_status_icon(status) - status = gen_status_link_icon(status, icon, suite, arch) + status, icon, spokenstatus = get_status_icon(status) + status = gen_status_link_icon(status, spokenstatus, icon, suite, arch) html = html_package_page.substitute( package=pkg, -- cgit v1.2.3-70-g09d2