[Qa-jenkins-scm] [jenkins.debian.net] 05/06: reproducible: _html_packages: improve gen_suites_links() for multiple architecture support

Holger Levsen holger at moszumanska.debian.org
Sat Aug 15 10:51:21 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 751b74789cda5cfcca419ae6e457949087aa8a9e
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Tue Aug 11 12:25:21 2015 +0000

    reproducible: _html_packages: improve gen_suites_links() for multiple architecture support
---
 bin/reproducible_html_packages.py | 44 ++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index 6a6bf5a..448df8c 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -148,32 +148,26 @@ def gen_extra_links(package, version, suite, arch, status):
     return (links, default_view)
 
 
-def gen_suites_links(package, suite):
-    # FIXME this function needs multiarchifing
-    arch = defaultarch
+def gen_suites_links(package, suite, arch):
     html = ''
-    for i in package._status:
-        if i == suite:  # don't link the current suite
+    for s in SUITES:
+        if s == suite:  # don't link the current suite
             continue
-        if package._status[i][arch].status == False:
-            continue  # The package is not available in that suite
-        status = package._status[i][arch].status
-        version = package._status[i][arch].version
-        if status == 'unreproducible':
-            status = 'FTBR'
-        elif status == 'not for us':
-            status = 'not_for_us'
+        status = package.get_status(s, arch)
+        if not status:  # The package is not available in that suite/arch
+            continue
+        version = package.get_tested_version(s, arch)
         html += '<span class="avoidwrap">\n' + tab
         if status != 'untested':
-            prefix = ' <a href="/' + i[0] + '/' + i[1] + '/index_' + status + '.html">'
+            prefix = '<a href="/{}/{}/index_{}.html">'.format(s, arch, status)
             suffix = '</a>\n'
         else:
-            prefix = ' '
+            prefix = ''
             suffix = '\n'
         icon = prefix + '<img src="/static/{icon}" alt="{status}" title="{status}"/>' + suffix
         html += icon.format(icon=join_status_icon(status)[1], status=status)
-        html += tab + ' <a href="' + RB_PKG_URI + '/' + suite + '/' + arch + \
-                '/' + package.name + '.html" target="_parent">' + suite + \
+        html += tab + ' <a href="' + RB_PKG_URI + '/' + s + '/' + arch + \
+                '/' + package.name + '.html" target="_parent">' + s + \
                 ':' + version + '</a>\n'
         html += '</span>\n'
     return tab*5 + (tab*7).join(html.splitlines(True))
@@ -196,11 +190,12 @@ def gen_packages_html(packages, no_clean=False):
                 build_date = package.get_build_date(suite, arch)
                 if status == False:  # the package is not in the checked suite
                     continue
-                log.debug('Generating the page of ' + pkg + '/' + suite + '@' +
-                          version + ' built at ' + build_date)
+                log.debug('Generating the page of %s/%s/%s @ %s built at %s',
+                          pkg, suite, arch, version, build_date)
 
-                links, default_view = gen_extra_links(pkg, version, suite, arch, status)
-                suites_links = gen_suites_links(package, suite)
+                links, default_view = gen_extra_links(
+                    pkg, version, suite, arch, status)
+                suites_links = gen_suites_links(package, suite, arch)
                 status, icon = join_status_icon(status, pkg, version)
                 status = gen_status_link_icon(status, icon, suite, arch)
 
@@ -215,8 +210,8 @@ def gen_packages_html(packages, no_clean=False):
                     suites_links=suites_links,
                     default_view=default_view)
                 destfile = RB_PKG_PATH + '/' + suite + '/' + arch + '/' + pkg + '.html'
-                desturl = REPRODUCIBLE_URL + RB_PKG_URI + '/' + suite + '/' + \
-                          arch + '/' + pkg + '.html'
+                desturl = REPRODUCIBLE_URL + RB_PKG_URI + '/' + suite + \
+                          '/' + arch + '/' + pkg + '.html'
                 title = pkg + ' - reproducible build results'
                 write_html_page(title=title, body=html, destfile=destfile,
                                 noheader=True, noendpage=True)
@@ -229,7 +224,8 @@ def gen_all_rb_pkg_pages(no_clean=False):
     query = 'SELECT DISTINCT name FROM sources'
     rows = query_db(query)
     pkgs = [Package(str(i[0]), no_notes=True) for i in rows]
-    log.info('Processing all ' + str(len(pkgs)) + ' package from all suites/architectures')
+    log.info('Processing all %s package from all suites/architectures',
+             len(pkgs))
     gen_packages_html(pkgs, no_clean=True)  # we clean at the end
     purge_old_pages()
 

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