[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible debian: restructure navigation

Holger Levsen holger at layer-acht.org
Sat May 14 13:30:21 UTC 2016


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 0b7321b84e16bfdab36ad3ec12077ae054a63af3
Author: Holger Levsen <holger at layer-acht.org>
Date:   Sat May 14 13:44:47 2016 +0200

    reproducible debian: restructure navigation
---
 bin/reproducible_common.py        | 77 ++++++++++++++++++++++----------
 bin/reproducible_common.sh        | 92 +++++++++++++++++++++++++++++----------
 bin/reproducible_html_packages.py | 21 ++-------
 3 files changed, 125 insertions(+), 65 deletions(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 0bc374a..e71eb71 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -165,11 +165,10 @@ html_footer = Template("""
   </div></body>
 </html>""" % (JOB_FOOTER, JENKINS_URL))
 
-html_head_page = Template((tab*2).join("""
+html_head_page = Template((tab*2).join(("""
 <header class="head">
   <h2>$page_title</h2>
   <ul class=\"menu\">
-$links
     <li>$suite/$arch:<ul class="children">
      <li>Notes:<ul class="children">
       <li><a href="/$suite/$arch/index_notes.html">packages with notes</a></li>
@@ -200,25 +199,30 @@ $links
         </a>
       </li>
      </ul></li>
-$pkgsetslink
+     $link_pkgsets
      <li>Recently tested:<ul class="children">
       <li><a href="/$suite/$arch/index_last_24h.html">packages tested in the last 24h</a></li>
       <li><a href="/$suite/arch/index_last_48h.html">packages tested in the last 48h</a></li>
      </ul></li>
     <li><a href="/$suite/$arch/index_all_abc.html">all tested packages (sorted alphabetically)</a></li>
     </ul></li>
-    <li><a href="/index_issues.html">issues</a></li>
-    <li><a href="/index_${arch}_scheduled.html">currently scheduled</a></li>
-    <li><a href="/index_notify.html" title="notify icon">⚑ packages with enabled notifications</a></li>
-    <li><a href="/$suite/index_dd-list.html">maintainers of unreproducible packages</a></li>
-    <li><a href="/index_repositories.html">repositories overview</a></li>
-    <li><a href="/reproducible.html">dashboard</a></li>
-    <li><a href="https://wiki.debian.org/ReproducibleBuilds" target="_blank">wiki</a></li>
-    <li><a href="https://reproducible.alioth.debian.org/blog/" target="_blank">blog</a></li>
-    <li><a href="https://Reproducible-builds.org" target="_blank">Reproducible-builds.org</a></li>
+    <li>Architectures:<ul class="children">
+     $link_archs
+     <li><a href="/index_${arch}_scheduled.html">currently scheduled</a></li>
+    </ul></li>
+    <li>Suites:<ul class="children">
+     $link_suites
+     <li><a href="/$suite/index_dd-list.html">maintainers of unreproducible packages</a></li>
+    </ul></li>
+    <li><a href="%s">Debian dashboard</a>
+    <ul class="children">
+     <li><a href="/index_issues.html">issues</a></li>
+     <li><a href="/index_repositories.html">repositories overview</a></li>
+     <li><a href="/index_notify.html" title="notify icon">⚑ packages with enabled notifications</a></li>
+    </ul></li>
   </ul>
-</header><div class="mainbody">""".splitlines(True)))
-
+$project_links
+</header><div class="mainbody">""" % REPRODUCIBLE_URL ).splitlines(True)))
 
 html_foot_page_style_note = Template((tab*2).join("""
 <p style="font-size:0.9em;">
@@ -233,6 +237,24 @@ html_foot_page_style_note = Template((tab*2).join("""
   indicates a closed bug. In cases of several bugs, the symbol is repeated.
 </p>""".splitlines(True)))
 
+html_project_links = Template((tab*2).join("""
+    <ul class="reproducible-links">
+        <li>Reproducible Builds projects links
+         <ul class="children"><li>
+            <a href="https://Reproducible-builds.org">Reproducible-builds.org</a><br />
+            Reproducible-builds.org - <a href="https://Reproducible-builds.org/docs/">HowTo</a><br />
+            Reproducible Debian - <a href="https://wiki.debian.org/ReproducibleBuilds">Wiki</a><br />
+            Reproducible builds <a href="https://reproducible.alioth.debian.org/blog/">weekly news</a><br />
+            </li><li>
+            Reproducible <a href="https://tests.reproducible-builds.org/archlinux/">Arch Linux</a> /
+            <a href="https://tests.reproducible-builds.org/coreboot/">coreboot</a> /
+            <a href="https://tests.reproducible-builds.org/fedora/">Fedora</a> /
+            <a href="https://tests.reproducible-builds.org/freebsd/">FreeBSD</a> /
+            <a href="https://tests.reproducible-builds.org/netbsd/">NetBSD</a> /
+            <a href="https://tests.reproducible-builds.org/openwrt/">OpenWrt</a>
+        </li></ul></li>
+    </ul>
+""".splitlines(True)))
 
 url2html = re.compile(r'((mailto\:|((ht|f)tps?)\://|file\:///){1}\S+)')
 
@@ -299,16 +321,18 @@ def convert_into_hms_string(duration):
 def _gen_pkg_sets_link(suite, arch):
     html = ''
     if suite != 'experimental':
-            html = '<li><a href="/$suite/$arch/index_pkg_sets.html">package sets</a></li>'
+            html = '<li><a href="/' + suite + '/' + arch + '/index_pkg_sets.html">package sets</a></li>'
     return html
 
-
-def _gen_links(suite, arch):
-    html = '<li>Architectures:'
+def _gen_arch_links(suite, arch):
+    html = '<li>'
     for a in ARCHS:
-        html += ' <a href="/$suite/index_suite_' + a + '_stats.html\">' + a + '</a>'
+        html += ' <a href="/' + suite + '/index_suite_' + a + '_stats.html\">' + a + '</a>'
     html += '</li>'
-    html += '<li>Suites:'
+    return html
+
+def _gen_suite_links(suite, arch):
+    html = '<li>'
     for s in SUITES:
         html += ' <a href="/' + s + '/index_suite_' + arch + '_stats.html">' + s + '</a>'
     html += '</li>'
@@ -324,14 +348,19 @@ def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch,
             page_title=title,
             meta_refresh=meta_refresh)
     if not noheader:
-        links = _gen_links(suite, arch)
-        pkgsetslink = _gen_pkg_sets_link(suite, arch)
+        link_archs = _gen_arch_links(suite, arch)
+        link_suites = _gen_suite_links(suite, arch)
+        link_pkgsets = _gen_pkg_sets_link(suite, arch)
+        project_links=html_project_links.substitute()
+
         html += html_head_page.substitute(
             page_title=title,
             suite=suite,
             arch=arch,
-            links=links,
-            pkgsetslink=pkgsetslink)
+            link_archs=link_archs,
+            link_suites=link_suites,
+            link_pkgsets=link_pkgsets,
+            project_links=project_links)
     html += body
     if style_note:
         html += html_foot_page_style_note.substitute()
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index cb9eb3b..57fb10b 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -181,10 +181,12 @@ write_icon() {
 }
 
 write_page_header() {
+	# this is really quite uncomprehensible and should be killed
+	# the solution is to write all html pages with python…
 	rm -f $PAGE
 	MAINVIEW="dashboard"
 	ALLSTATES="reproducible FTBR FTBFS depwait not_for_us 404 blacklisted"
-	ALLVIEWS="issues notes no_notes scheduled last_24h last_48h all_abc notify dd-list pkg_sets suite_stats arch repositories dashboard"
+	ALLVIEWS="notes no_notes pkg_sets last_24h last_48h all_abc arch scheduled suite_stats dd-list dashboard issues repositories notify"
 	GLOBALVIEWS="issues scheduled notify repositories dashboard"
 	SUITEVIEWS="dd-list suite_stats"
 	SPOKENTARGET["issues"]="issues"
@@ -199,7 +201,7 @@ write_page_header() {
 	SPOKENTARGET["pkg_sets"]="package sets"
 	SPOKENTARGET["suite_stats"]="suite: $SUITE"
 	SPOKENTARGET["repositories"]="repositories overview"
-	SPOKENTARGET["dashboard"]="dashboard"
+	SPOKENTARGET["dashboard"]="Debian dashboard"
 	write_page "<!DOCTYPE html><html><head>"
 	write_page "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"
 	write_page "<meta name=\"viewport\" content=\"width=device-width\" />"
@@ -210,14 +212,8 @@ write_page_header() {
 	else
 		write_page "<body class=\"wrapper\" onload=\"selectSearch()\"><header class=\"head\"><h2>$2</h2>"
 	fi
-	write_page "<ul class=\"menu\"><li>Package states:"
-	write_page "<ul class=\"children\"><li>"
-	for MY_STATE in $ALLSTATES ; do
-		set_icon $MY_STATE
-		write_icon
-		write_page " "
-	done
-	write_page "</li></ul></li>"
+	write_page "<ul class=\"menu\">"
+	write_page "<li>$SUITE/$ARCH:<ul class=\"children\">"
 	for TARGET in $ALLVIEWS ; do
 		if [ "$TARGET" = "pkg_sets" ] && [ "$SUITE" = "experimental" ] ; then
 			# no pkg_sets are tested in experimental
@@ -236,30 +232,78 @@ write_page_header() {
 				BASEURL="/$SUITE"
 			fi
 		done
-		if [ "$TARGET" = "suite_stats" ] ; then
-			for i in $SUITES ; do
-				write_page "<li><a href=\"/$i/index_suite_${ARCH}_stats.html\">suite: $i</a></li>"
-			done
-		elif [ "$TARGET" = "scheduled" ] ; then
+		# prepare unsorted lists
+		if [ "$TARGET" = "notes" ] ; then
+			write_page "<li>Notes<ul class=\"children\">"
+		elif [ "$TARGET" = "last_24h" ] ; then
+			write_page "<li>Recently tested:<ul class=\"children\">"
+		fi
+		# prepare links
+		if [ "$TARGET" = "scheduled" ] ; then
 			write_page "<li><a href=\"/index_${ARCH}_scheduled.html\">${SPOKEN_TARGET}</a></li>"
 		elif [ "$TARGET" = "notify" ] ; then
 			write_page "<li><a href=\"$BASEURL/index_${TARGET}.html\" title=\"notify icon\">${SPOKEN_TARGET}</a></li>"
 		elif [ "$TARGET" = "arch" ] ; then
-			for LINKARCH in ${ARCHS} ; do
-				if [ "$ARCH"  = "$LINKARCH" ] ; then
-					continue
-				else
-					write_page "<li><a href=\"/unstable/index_suite_${LINKARCH}_stats.html\">arch: $LINKARCH</a></li>"
-				fi
+			write_page "<li>Architectures:<ul class=\"children\"><li>"
+			for i in ${ARCHS} ; do
+				write_page " <a href=\"/$SUITE/index_suite_${i}_stats.html\">$i</a>"
 			done
+			write_page "</li>"
+		elif [ "$TARGET" = "suite_stats" ] ; then
+			write_page "<li>Suites:<ul class=\"children\"><li>"
+			for i in $SUITES ; do
+				write_page " <a href=\"/$i/index_suite_${ARCH}_stats.html\">$i</a>"
+			done
+			write_page "</li>"
+		elif [ "$TARGET" = "dashboard" ] ; then
+			write_page "<li><a href=\"$BASEURL/index_${TARGET}.html\">${SPOKEN_TARGET}</a><ul class=\"children\">"
 		else
+			# finally, write link
 			write_page "<li><a href=\"$BASEURL/index_${TARGET}.html\">${SPOKEN_TARGET}</a></li>"
 		fi
+		# close unsorted lists (and package states loop)
+		if [ "$TARGET" = "all_abc" ] ; then
+			write_page "</ul></li>"
+		elif [ "$TARGET" = "last_48h" ] ; then
+			write_page "</ul></li>"
+		elif [ "$TARGET" = "notify" ] ; then
+			write_page "</ul></li>"
+		elif [ "$TARGET" = "scheduled" ] ; then
+			write_page "</ul></li>"
+		elif [ "$TARGET" = "dd-list" ] ; then
+			write_page "</ul></li>"
+		elif [ "$TARGET" = "no_notes" ] ; then
+			write_page "</ul></li>"
+			# after notes we have package states
+			write_page "<li>Package states:"
+			write_page "<ul class=\"children\"><li>"
+			for MY_STATE in $ALLSTATES ; do
+				set_icon $MY_STATE
+			write_icon
+			write_page " "
+			done
+			write_page "</li></ul></li>"
+		fi
 	done
-	write_page "<li><a href=\"https://wiki.debian.org/ReproducibleBuilds\" target=\"_blank\">wiki</a></li>"
-	write_page "<li><a href=\"https://reproducible.alioth.debian.org/blog/\" target=\"_blank\">blog</a></li>"
-	write_page "<li><a href=\"https://Reproducible-builds.org\" target=\"_blank\">Reproducible-builds.org</a></li>"
 	write_page "</ul>"
+	# project links
+	write_page "    <ul class=\"reproducible-links\">"
+	write_page "        <li>Reproducible Builds projects links"
+	write_page "         <ul class=\"children\"><li>"
+	write_page "            <a href=\"https://Reproducible-builds.org\">Reproducible-builds.org</a><br />"
+	write_page "            Reproducible-builds.org - <a href=\"https://Reproducible-builds.org/docs/\">HowTo</a><br />"
+	write_page "            Reproducible Debian - <a href=\"https://wiki.debian.org/ReproducibleBuilds\">Wiki</a><br />"
+	write_page "            Reproducible builds <a href=\"https://reproducible.alioth.debian.org/blog/\">weekly news</a><br />"
+	write_page "            </li><li>"
+	write_page "            Reproducible <a href=\"https://tests.reproducible-builds.org/archlinux/\">Arch Linux</a> /"
+	write_page "            <a href=\"https://tests.reproducible-builds.org/coreboot/\">coreboot</a> /"
+	write_page "            <a href=\"https://tests.reproducible-builds.org/fedora/\">Fedora</a> /"
+	write_page "            <a href=\"https://tests.reproducible-builds.org/freebsd/\">FreeBSD</a> /"
+	write_page "            <a href=\"https://tests.reproducible-builds.org/netbsd/\">NetBSD</a> /"
+	write_page "            <a href=\"https://tests.reproducible-builds.org/openwrt/\">OpenWrt</a>"
+	write_page "        </li></ul></li>"
+	write_page "    </ul>"
+	# end project links
 	write_page "</header>"
 	write_page "<div class=\"mainbody\">"
 	if [ "$1" = "$MAINVIEW" ] ; then
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index fc59f3e..fe64450 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -39,25 +39,10 @@ html_package_page = Template((tab*2).join(("""
         <li>
           <a href="$history" target="main">Test history</a>
         </li>
-    </ul>
-
 ${suites_links}
-
-    <ul class="reproducible-links">
-        Reproducible Builds projects links
-        <li>
-            tests.reproducible-builds.org - <a href="%s">Debian Dashboard</a><br />
-            Reproducible Debian - <a href="https://wiki.debian.org/ReproducibleBuilds">Wiki</a><br />
-            Reproducible-builds.org - <a href="https://Reproducible-builds.org/docs/">HowTo</a><br />
-            <a href="https://Reproducible-builds.org">Reproducible-builds.org</a><br />
-            Reproducible <a href="https://tests.reproducible-builds.org/archlinux/">Arch Linux</a> /
-            <a href="https://tests.reproducible-builds.org/coreboot/">coreboot</a> /
-            <a href="https://tests.reproducible-builds.org/fedora/">Fedora</a> /
-            <a href="https://tests.reproducible-builds.org/freebsd/">FreeBSD</a> /
-            <a href="https://tests.reproducible-builds.org/netbsd/">NetBSD</a> /
-            <a href="https://tests.reproducible-builds.org/openwrt/">OpenWrt</a>
-        </li>
+     <li><a href="%s">Debian dashboard</a></li></ul>
     </ul>
+${project_links}
 </header>
 
 <iframe id="main" name="main" tabindex="1" src="${default_view}">
@@ -271,6 +256,7 @@ def gen_packages_html(packages, no_clean=False):
                 status, icon, spokenstatus = get_status_icon(status)
                 status = gen_status_link_icon(status, spokenstatus, icon, suite, arch)
                 history = '{}/{}.html'.format(HISTORY_URI, pkg)
+                project_links = html_project_links.substitute()
 
                 html = html_package_page.substitute(
                     package=pkg,
@@ -283,6 +269,7 @@ def gen_packages_html(packages, no_clean=False):
                     links=links,
                     notify_maintainer=package.notify_maint,
                     suites_links=suites_links,
+                    project_links=project_links,
                     default_view=default_view)
                 destfile = RB_PKG_PATH + '/' + suite + '/' + arch + '/' + pkg + '.html'
                 desturl = REPRODUCIBLE_URL + RB_PKG_URI + '/' + suite + \

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