[Qa-jenkins-scm] [jenkins.debian.net] 03/04: reproducible: refactor and fix status icons for all stati

Holger Levsen holger at moszumanska.debian.org
Sat Oct 3 23:53:36 UTC 2015


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 f4c68f1d927c2aabaf73014b02c81f2067161628
Author: Holger Levsen <holger at layer-acht.org>
Date:   Sun Oct 4 01:43:06 2015 +0200

    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(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index f621bea..fcb35f0 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 a5875b7..3c078eb 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 = """
         <a href="/{suite}/{arch}/index_{status}.html" target="_parent" title="{spokenstatus}">
             <img src="/static/{icon}" alt="{spokenstatus}"></a>
@@ -86,7 +80,7 @@ def gen_status_link_icon(status, icon, suite, arch):
 
     # There are no indices for untested packages
     if status == 'untested':
-        html = '<img src="/static/{icon}" alt="{status}"> {status}'
+        html = '<img src="/static/{icon}" alt="{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 += '<li class="' + ' '.join(li_classes) + '">\n' + tab
-            if s != current_suite or a != current_arch or status != 'untested':
-                prefix = '<a href="/{}/{}/index_{}.html">'.format(s, a, status)
-                suffix = '</a>\n'
-            else:
+            if ( s == current_suite and a == current_arch ) or status == 'untested':
                 prefix = ''
                 suffix = '\n'
-            icon = prefix + '<img src="/static/{icon}" alt="{status}" title="{status}"/>' + suffix
-            html += icon.format(icon=get_status_icon(status)[1], status=status)
+            else:
+                prefix = '<a href="/{}/{}/index_{}.html">'.format(s, a, status)
+                suffix = '</a>\n'
+            icon_html = prefix + '<img src="/static/{icon}" alt="{spokenstatus}" title="{spokenstatus}"/>' + suffix
+            html += icon_html.format(icon=icon, status=status, spokenstatus=spokenstatus)
             html += (tab*2 + ' <a href="{}/{}/{}/{}.html" target="_parent"' + \
                      ' title="{}: {}{}">{}</a> in <a href="/{}/{}/" target="_parent">{}</a>\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 += '</li>\n'
         html += tab + '</ul></li>'
     html += '</ul>\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,

-- 
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