[Qa-jenkins-scm] [jenkins.debian.net] 09/11: reproducible debian: add collapsible sections to pkgset navigation

Holger Levsen holger at layer-acht.org
Sun Jul 24 15:46:18 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 d5182ed952f11ff7452f9d3c420a5d42595e197a
Author: Valerie R Young <spectranaut at riseup.net>
Date:   Tue Jul 19 18:29:01 2016 -0400

    reproducible debian: add collapsible sections to pkgset navigation
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_common.py                |  3 ++-
 bin/reproducible_html_pkg_sets.py         | 29 +++++++++++++----------
 bin/templates/pkgset_details.mustache     | 21 +++++++++--------
 bin/templates/pkgset_navigation.mustache  | 38 ++++++++++++++++++++++---------
 userContent/reproducible/static/style.css |  8 +++++++
 5 files changed, 66 insertions(+), 33 deletions(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 7566e78..1c2df8e 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -83,11 +83,12 @@ DEBIAN_DASHBOARD_URI = '/debian/reproducible.html'
 JENKINS_URL = 'https://jenkins.debian.net'
 
 # global package set definitions
+# META_PKGSET[pkgset_id] = (pkgset_name, pkgset_group)
 # csv file columns: (pkgset_id, pkgset_group, pkgset_name)
 META_PKGSET = {}
 with open(os.path.join(BIN_PATH, './meta_pkgset.csv'), newline='') as f:
     for line in csv.reader(f):
-        META_PKGSET[int(line[0])] = line[2]
+        META_PKGSET[int(line[0])] = (line[2], line[1])
 
 parser = argparse.ArgumentParser()
 group = parser.add_mutually_exclusive_group()
diff --git a/bin/reproducible_html_pkg_sets.py b/bin/reproducible_html_pkg_sets.py
index dbdca13..c38370a 100755
--- a/bin/reproducible_html_pkg_sets.py
+++ b/bin/reproducible_html_pkg_sets.py
@@ -17,6 +17,7 @@ import csv
 import time
 import sqlite3
 import pystache
+from collections import OrderedDict
 
 # Templates used for creating package pages
 renderer = pystache.Renderer()
@@ -114,30 +115,34 @@ def update_stats(suite, arch, stats, pkgset_name):
 
 
 def create_pkgset_navigation(suite, arch, view=None):
-    context = {
-        'package_sets': [],
-        'suite': suite,
-        'arch': arch,
-    }
-
+    # Group the package sets by section
+    sections = OrderedDict()
     for index in range(1, len(META_PKGSET)+1):
-        pkgset_name = META_PKGSET[index]
+        pkgset_name = META_PKGSET[index][0]
+        pkgset_section = META_PKGSET[index][1]
         pkgset = {
             'class': "active" if pkgset_name == view else "",
             'pkgset_name': pkgset_name,
         }
-
         thumb_file, thumb_href = stats_thumb_file_href(suite, arch, pkgset_name)
         # if the graph image doesn't exist, don't include it in the context
         if os.access(thumb_file, os.R_OK):
             pkgset['thumb'] = thumb_href
-        context['package_sets'].append(pkgset)
+        # add the package set to the appropriate section
+        sections.setdefault(pkgset_section, []).append(pkgset)
 
+    context = {
+        'suite': suite,
+        'arch': arch,
+        'pkgset_page': True if view else False
+    }
+    context['package_set_sections'] = \
+        [{'section': s, 'pkgsets': sections[s]} for s in sections]
     return renderer.render(pkgset_navigation_template, context)
 
 
 def create_index_page(suite, arch):
-    title = 'Package sets in %s/%s for Reproducible Builds' % (suite, arch)
+    title = 'Package sets in %s/%s' % (suite, arch)
     body = create_pkgset_navigation(suite, arch)
     destfile = os.path.join(DEBIAN_BASE, suite, arch,
                             "index_pkg_sets.html")
@@ -242,7 +247,7 @@ def create_pkgset_page_and_graphs(suite, arch, stats, pkgset_name):
             pkgset_context['status_details'].append(details_context)
 
     html_body += renderer.render(pkgset_details_template, pkgset_context)
-    title = 'Reproducible Builds %s package set for %s/%s for' % \
+    title = '%s package set for %s/%s' % \
             (pkgset_name, suite, arch)
     page = "pkg_set_" + pkgset_name + ".html"
     destfile = os.path.join(DEBIAN_BASE, suite, arch, page)
@@ -298,7 +303,7 @@ for arch in ARCHS:
             continue
         create_index_page(suite, arch)
         for index in META_PKGSET:
-            pkgset_name = META_PKGSET[index]
+            pkgset_name = META_PKGSET[index][0]
             stats = gather_meta_stats(suite, arch, pkgset_name)
             if (stats):
                 update_stats(suite, arch, stats, pkgset_name)
diff --git a/bin/templates/pkgset_details.mustache b/bin/templates/pkgset_details.mustache
index e767118..d29576a 100644
--- a/bin/templates/pkgset_details.mustache
+++ b/bin/templates/pkgset_details.mustache
@@ -1,17 +1,20 @@
 <p>
 {{#png}}
-  <a href="{{png}}"><img src="{{png}}" class="overview" alt="package set {{pkgset_name}} in {{suite}}/{{arch}}"></a>"
-{{/png}}
-
+  <a href="{{png}}">
+    <img src="{{png}}" class="overview"
+     title="Package set {{pkgset_name}} in {{suite}}/{{arch}}. (To switch suite and arch, see top left.)"
+     alt="package set {{pkgset_name}} in {{suite}}/{{arch}}">
+  </a>"
+  {{/png}}
   <br />
-  The package set '{{pkgset_name}}' in {{suite}}/{{arch}} consists of:
-  (see this package set on {{#other_archs}}<a href="{{link}}" title="See this packageset in unstable/{{arch}}">{{arch}}</a>
-{{/other_archs}})
-
+  The package set <span class="highlight">{{pkgset_name}}</span> in
+  <span class="highlight">{{suite}}/{{arch}}</span> consists of:
   <br />
   {{#status_details}}
-  {{{icon_html}}} {{status_count}} ({{status_percent}}%) packages {{description}}: {{{package_list_html}}}
+  {{{icon_html}}} {{status_count}} ({{status_percent}}%) packages
+  {{description}}:
+  {{{package_list_html}}}
   <br />
   {{/status_details}}
   {{{pkg_symbol_legend_html}}}
-</op>
+</p>
diff --git a/bin/templates/pkgset_navigation.mustache b/bin/templates/pkgset_navigation.mustache
index 40d19c1..81ee338 100644
--- a/bin/templates/pkgset_navigation.mustache
+++ b/bin/templates/pkgset_navigation.mustache
@@ -1,14 +1,30 @@
-<ul>
-  <li>Tracked package sets in {{suite}}/{{arch}}: </li>
-<br/>
-{{#package_sets}}
+<ul><li>
+  <a href="/debian/{{suite}}/{{arch}}/index_pkg_sets.html"
+     title="To switch suite and arch, see top left">
+    All tracked package sets for <b>{{suite}}/{{arch}}</b>
+  </a>
+</li></ul>
+{{#package_set_sections}}
+<details {{^pkgset_page}}open{{/pkgset_page}}>
+  <summary>{{section}} package sets:</summary>
+  <ul class="pkgset-list">
+  {{#pkgsets}}
   <li class="{{class}}">
-	<a href="/debian/{{suite}}/{{arch}}/pkg_set_{{pkgset_name}}.html">{{pkgset_name}}</a>
-  {{#thumb}}
-	<a href="/debian/{{suite}}/{{arch}}/pkg_set_{{pkgset_name}}.html">
-	  <img src="{{thumb}}" class="setview" alt="Reproducibility status for packages un {{suite}}/{{arch}} from '{{pkg_name}}'" title="{{pkgset_name}}" name="{{pkgset_name}}">
-	</a>
-  {{/thumb}}
+    <a href="/debian/{{suite}}/{{arch}}/pkg_set_{{pkgset_name}}.html">
+      {{pkgset_name}}
+    </a>
+    {{#thumb}}
+    <a href="/debian/{{suite}}/{{arch}}/pkg_set_{{pkgset_name}}.html">
+      <img src="{{thumb}}" class="setview"
+           alt="Reproducibility status for packages in {{suite}}/{{arch}} from '{{pkg_name}}'"
+           title="{{pkgset_name}}" name="{{pkgset_name}}">
+    </a>
+    {{/thumb}}
   </li>
-{{/package_sets}}
+  {{/pkgsets}}
 </ul>
+</details>
+{{/package_set_sections}}
+{{#pkgset_page}}
+<hr id="footer_separator" />
+{{/pkgset_page}}
diff --git a/userContent/reproducible/static/style.css b/userContent/reproducible/static/style.css
index 5637ee7..bdc0e75 100644
--- a/userContent/reproducible/static/style.css
+++ b/userContent/reproducible/static/style.css
@@ -116,6 +116,10 @@ a.package:visited, a.noted:visited {
 	background-color: #bfeaff;
 }
 
+span.highlight {
+	color: #d70a53;
+	font-weight: bold;
+}
 
 ul.new-menu {
 	border-top: 1px solid #eee;
@@ -133,6 +137,10 @@ ul.reproducible-links li a {
 	padding: 0;
 }
 
+ul.pkgset-list {
+	margin: 0.5em;
+}
+
 header {
 	border-bottom: 1px solid #d70a53;
 }

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