[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible: common.py generate navigation links, instead of templating them. This allows way more flexibility

Holger Levsen holger at moszumanska.debian.org
Fri Mar 6 13:37:22 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 4eaeda5d111b52155b99a9fc88c4ec175acba80d
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Fri Mar 6 13:52:48 2015 +0100

    reproducible: common.py generate navigation links, instead of templating them. This allows way more flexibility
---
 bin/reproducible_common.py | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index a3f84c6..ff5496e 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -151,11 +151,6 @@ html_head_page = Template((tab*2).join("""
     <li><a href="/index_issues.html">issues</a></li>
     <li><a href="/index_notes.html">packages with notes</a></li>
     <li><a href="/index_no_notes.html">package without notes</a></li>
-    <li><a href="index_scheduled.html">currently scheduled</a></li>
-    <li><a href="index_last_24h.html">packages tested in the last 24h</a></li>
-    <li><a href="index_last_48h.html">packages tested in the last 48h</a></li>
-    <li><a href="index_all_abc.html">all tested packages (sorted alphabetically)</a></li>
-    <li><a href="index_dd-list.html">maintainers of unreproducible packages</a></li>
 $links
     <li><a href="/index_repo_stats.html">repositories overview</a></li>
     <li><a href="/reproducible.html">reproducible stats</a></li>
@@ -163,6 +158,7 @@ $links
   </ul>
 </header>""".splitlines(True)))
 
+
 html_foot_page_style_note = Template((tab*2).join("""
 <p style="font-size:0.9em;">
   A package name displayed with a bold font is an indication that this
@@ -188,19 +184,30 @@ def print_critical_message(msg):
 
 
 def _gen_links(suite, arch):
-    links = ''
-    if suite and suite != 'experimental':
-        link += '<li><a href="/' + suite + '/' + arch + \
-                '/index_pkg_sets.html">package sets stats</a></li>'
-    if suite and suite == 'experimental':
-        link += '<li><a href="/sid/' + arch + \
-                '/index_pkg_sets.html">package sets stats</a></li>'
-    if suite:
-        suite_links += '<li><a href="/' + suite +'">suite: ' + suite + '</a></li>'
-    for i in SUITES:
+    links = [
+        ('scheduled', '<li><a href="/{suite}/{arch}/index_scheduled.html">currently scheduled</a></li>'),
+        ('last_24h', '<li><a href="/{suite}/{arch}/index_last_24h.html">packages tested in the last 24h</a></li>'),
+        ('last_48h', '<li><a href="/{suite}/{arch}/index_last_48h.html">packages tested in the last 48h</a></li>'),
+        ('all_abc', '<li><a href="/{suite}/{arch}/index_all_abc.html">all tested packages (sorted alphabetically)</a></li>'),
+        ('dd-list', '<li><a href="/{suite}/{arch}/index_dd-list.html">maintainers of unreproducible packages</a></li>'),
+        ('pkg_sets', '<li><a href="/{suite}/{arch}/index_pkg_sets.html">package sets stats</a></li>')
+    ]
+    html = ''
+    for link in links:
+        if link[0] == 'pkg_sets' and suite and suite == 'experimental':
+            html += link[1].format(suite='sid', arch=arch) + '\n'
+            continue
+        if suite:
+            html += link[1].format(suite=suite, arch=arch) + '\n'
+        if not suite:
+            html += link[1].format(suite='sid', arch=arch) + '\n'
+    if suite:  # suite stats
+        html += '<li><a href="/' + suite + \
+                '/index_suite_stats.html">suite: ' + suite + '</a></li>'
+    for i in SUITES:  # suite links
            if i != suite:
-                suite_links += '<li><a href="/' + i +'">suite: ' + i + '</a></li>'
-    return suite_links
+                html += '<li><a href="/' + i +'">suite: ' + i + '</a></li>'
+    return html
 
 
 def write_html_page(title, body, destfile, suite=None, noheader=False, style_note=False, noendpage=False):

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