summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-07-12 10:35:42 -0400
committerHolger Levsen <holger@layer-acht.org>2016-07-24 11:46:02 -0400
commit1dea20a0d5081e8fa1f864e82977dc9d365a8565 (patch)
treea3b1ec29e007e9eaaab0a146dcc99d54e56ffab0 /bin
parent1f6e833815c011e56ab77a258b4eee94a8acaf43 (diff)
downloadjenkins.debian.net-1dea20a0d5081e8fa1f864e82977dc9d365a8565.tar.xz
reproducible debian: use main navigation template in bash scripts
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_common.sh199
-rw-r--r--bin/templates/basic_page.mustache4
-rw-r--r--bin/templates/main_navigation.mustache203
3 files changed, 183 insertions, 223 deletions
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 7f239608..52488936 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -106,6 +106,9 @@ done < $BIN_PATH/meta_pkgset.csv
# mustache templates
PAGE_FOOTER_TEMPLATE=$TEMPLATE_PATH/default_page_footer.mustache
+PROJECT_LINKS_TEMPLATE=$TEMPLATE_PATH/project_links.mustache
+MAIN_NAVIGATION_TEMPLATE=$TEMPLATE_PATH/main_navigation.mustache
+
# sleep 1-23 secs to randomize start times
delay_start() {
@@ -162,146 +165,92 @@ write_page_header() {
# 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="notes no_notes pkg_sets last_24h last_48h all_abc arch scheduled suite_stats dd-list dashboard issues repositories notify performance variations breakages"
- GLOBALVIEWS="issues scheduled notify repositories dashboard performance variations breakages"
- SUITEVIEWS="dd-list suite_stats"
- SPOKENTARGET["issues"]="issues"
- SPOKENTARGET["notes"]="packages with notes"
- SPOKENTARGET["no_notes"]="packages without notes"
- SPOKENTARGET["scheduled"]="currently scheduled"
- SPOKENTARGET["last_24h"]="packages tested in the last 24h"
- SPOKENTARGET["last_48h"]="packages tested in the last 48h"
- SPOKENTARGET["all_abc"]="all tested packages (sorted alphabetically)"
- SPOKENTARGET["notify"]="⚑ packages with enabled notifications"
- SPOKENTARGET["dd-list"]="maintainers of unreproducible packages"
- SPOKENTARGET["pkg_sets"]="package sets"
- SPOKENTARGET["suite_stats"]="suite: $SUITE"
- SPOKENTARGET["repositories"]="repositories overview"
- SPOKENTARGET["dashboard"]="Debian dashboard"
- SPOKENTARGET["performance"]="performance stats"
- SPOKENTARGET["variations"]="variations tested"
- SPOKENTARGET["breakages"]="broken pieces"
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\" />"
write_page "<link href=\"/static/style.css\" type=\"text/css\" rel=\"stylesheet\" />"
write_page "<title>$2</title></head>"
if [ "$1" != "$MAINVIEW" ] ; then
- write_page "<body class=\"wrapper\"><header class=\"head\"><h2>$2</h2>"
+ write_page "<body class=\"wrapper\">"
+ else
+ write_page "<body class=\"wrapper\" onload=\"selectSearch()\">"
+ fi
+
+ # Build context for the main_navigation mustache template.
+
+ # Do not show package set links for "experimental" pages
+ if [ "$SUITE" != "experimental" ] ; then
+ # no pkg_sets are tested in experimental
+ include_pkgset_link="\"include_pkgset_link\" : \"true\""
+ else
+ include_pkgset_link=''
+ fi
+
+ # Used to highlight the link for the current page
+ if [ "$1" = "dashboard" ] || [ "$1" = "performance" ] || [ "$1" = "repositories" ] || [ "$1" = "variations" ] ; then
+ displayed_page="\"$1\": \"true\""
else
- write_page "<body class=\"wrapper\" onload=\"selectSearch()\"><header class=\"head\"><h2>$2</h2>"
+ displayed_page=''
fi
- write_page "<ul class=\"menu\">"
- write_page "<li>$SUITE/$ARCH:<ul class=\"children\">"
- local CLASS=""
- for TARGET in $ALLVIEWS ; do
- CLASS=""
- if [ "$TARGET" = "pkg_sets" ] && [ "$SUITE" = "experimental" ] ; then
- # no pkg_sets are tested in experimental
- continue
+
+ # Create json for suite links (a list of objects)
+ suite_links="\"suite_list\": ["
+ comma=0
+ for i in $SUITES ; do
+ if [ "$1" = "suite_arch_stats" ] && [ "$i" = "$SUITE" ] ; then
+ class="class='active'"
+ else
+ class=''
fi
- SPOKEN_TARGET=${SPOKENTARGET[$TARGET]}
- BASEURL="/debian/$SUITE/$ARCH"
- local i
- for i in $GLOBALVIEWS ; do
- if [ "$TARGET" = "$i" ] ; then
- BASEURL="/debian"
- fi
- done
- for i in ${SUITEVIEWS} ; do
- if [ "$TARGET" = "$i" ] ; then
- BASEURL="/debian/$SUITE"
- fi
- done
- # 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\">"
+ if [ $comma == 1 ] ; then
+ suite_links+=", {\"s\": \"$i\", \"class\": \"$class\"}"
+ else
+ suite_links+="{\"s\": \"$i\", \"class\": \"$class\"}"
+ comma=1
fi
- # prepare links
- if [ "$TARGET" = "scheduled" ] ; then
- write_page "<li><a href=\"/debian/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
- write_page "<li>Architectures:<ul class=\"children\"><li>"
- for i in ${ARCHS} ; do
- if [ "$1" = "suite_arch_stats" ] && [ "$i" = "$ARCH" ] ; then
- CLASS=" class=\"active\""
- fi
- write_page " <a href=\"/debian/$SUITE/index_suite_${i}_stats.html\"$CLASS>$i</a>&nbsp;&nbsp;"
- CLASS=""
- done
- write_page "</li>"
- elif [ "$TARGET" = "suite_stats" ] ; then
- write_page "<li>Suites:<ul class=\"children\"><li>"
- for i in $SUITES ; do
- if [ "$1" = "suite_arch_stats" ] && [ "$i" = "$SUITE" ] ; then
- CLASS=" class=\"active\""
- fi
- write_page " <a href=\"/debian/$i/index_suite_${ARCH}_stats.html\"$CLASS>$i</a>&nbsp;&nbsp;"
- CLASS=""
- done
- write_page "</li>"
- elif [ "$TARGET" = "dashboard" ] ; then
- if [ "$1" = "dashboard" ] ; then
- CLASS=" class=\"active\""
- fi
- write_page "<li><a href=\"$BASEURL/index_${TARGET}.html\"$CLASS>${SPOKEN_TARGET}</a><ul class=\"children\">"
+ done
+ suite_links+="]"
+
+ # Create json for arch links (a list of objects)
+ arch_links="\"arch_list\": ["
+ comma=0
+ for i in ${ARCHS} ; do
+ if [ "$1" = "suite_arch_stats" ] && [ "$i" = "$ARCH" ] ; then
+ class="class='active'"
else
- if [ "$1" = "$TARGET" ] ; then
- CLASS=" class=\"active\""
- fi
- write_page "<li><a href=\"$BASEURL/index_${TARGET}.html\"$CLASS>${SPOKEN_TARGET}</a></li>"
+ class=''
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" = "breakages" ] ; 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>"
+ if [ $comma == 1 ] ; then
+ arch_links+=", {\"a\": \"$i\", \"class\": \"$class\"}"
+ else
+ arch_links+="{\"a\": \"$i\", \"class\": \"$class\"}"
+ comma=1
fi
done
- 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 " <a href=\"https://reproducible-builds.org/specs/source-date-epoch/\">SOURCE_DATE_EPOCH specification</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 " <a href=\"https://tests.reproducible-builds.org/lede/\">LEDE</a>"
- write_page " </li></ul></li>"
- write_page " </ul>"
- # end project links
+ arch_links+="]"
+
+ # finally, the completely formed JSON context
+ context=$(printf '{
+ "arch" : "%s",
+ "suite" : "%s",
+ "page_title" : "%s",
+ "debian_url" : "%s",
+ %s,
+ %s
+ ' "$ARCH" "$SUITE" "$2" "$DEBIAN_URL" "$arch_links" "$suite_links")
+ if [[ ! -z $displayed_page ]] ; then
+ context+=", $displayed_page"
+ fi
+ if [[ ! -z $include_pkgset_link ]] ; then
+ context+=", $include_pkgset_link"
+ fi
+ context+="}"
+
+ write_page "<header class=\"head\">"
+ write_page "$(pystache3 $MAIN_NAVIGATION_TEMPLATE "$context")"
+ write_page "$(pystache3 $PROJECT_LINKS_TEMPLATE "{}")"
write_page "</header>"
+
write_page "<div class=\"mainbody\">"
if [ "$1" = "$MAINVIEW" ] ; then
write_page "<ul>"
diff --git a/bin/templates/basic_page.mustache b/bin/templates/basic_page.mustache
index 1239a4a0..345d2da0 100644
--- a/bin/templates/basic_page.mustache
+++ b/bin/templates/basic_page.mustache
@@ -8,7 +8,9 @@
<title>{{page_title}}</title>
</head>
<body class="wrapper">
- {{{main_navigation_html}}}
+ <header class="head">
+ {{{main_navigation_html}}}
+ </header>
<div class="mainbody">
{{{main_html}}}
</div>
diff --git a/bin/templates/main_navigation.mustache b/bin/templates/main_navigation.mustache
index 6dab1692..ab905fd2 100644
--- a/bin/templates/main_navigation.mustache
+++ b/bin/templates/main_navigation.mustache
@@ -1,109 +1,118 @@
-<header class="head">
- <h2>{{page_title}}</h2>
- <ul class="menu">
- <li>{{suite}}/{{arch}}:<ul class="children">
- <li>Notes:<ul class="children">
- <li {{#notes}}class='active'{{/notes}}>
- <a href="/debian/{{suite}}/{{arch}}/index_notes.html">
- packages with notes
- </a>
- </li>
- <li {{#no_notes}}class='active'{{/no_notes}}>
- <a href="/debian/{{suite}}/{{arch}}/index_no_notes.html">
- packages without notes
- </a>
- </li>
- </ul></li>
- <li>Package states:<ul class="children">
- <li>
- <a href="/debian/{{suite}}/{{arch}}/index_reproducible.html" target="_parent">
- <img src="/static/weather-clear.png" alt="reproducible icon" />
- </a>
- <a href="/debian/{{suite}}/{{arch}}/index_FTBR.html" target="_parent">
- <img src="/static/weather-showers-scattered.png" alt="FTBR icon" />
- </a>
- <a href="/debian/{{suite}}/{{arch}}/index_FTBFS.html" target="_parent">
- <img src="/static/weather-storm.png" alt="FTBFS icon" />
- </a>
- <a href="/debian/{{suite}}/{{arch}}/index_depwait.html" target="_parent">
- <img src="/static/weather-snow.png" alt="depwait icon" />
- </a>
- <a href="/debian/{{suite}}/{{arch}}/index_not_for_us.html" target="_parent">
- <img src="/static/weather-few-clouds-night.png" alt="not_for_us icon" />
- </a>
- <a href="/debian/{{suite}}/{{arch}}/index_404.html" target="_parent">
- <img src="/static/weather-severe-alert.png" alt="404 icon" />
- </a>
- <a href="/debian/{{suite}}/{{arch}}/index_blacklisted.html" target="_parent">
- <img src="/static/error.png" alt="blacklisted icon" />
- </a>
- </li>
- </ul></li>
- {{#include_pkgset_link}}
- <li {{#pkg_set}}class='active'{{/pkg_set}}>
- <a href="/debian/{{suite}}/{{arch}}/index_pkg_sets.html">
- package sets
+<h2>{{page_title}}</h2>
+<ul class="menu">
+ <li>{{suite}}/{{arch}}:<ul class="children">
+ <li>Notes:<ul class="children">
+ <li {{#notes}}class='active'{{/notes}}>
+ <a href="/debian/{{suite}}/{{arch}}/index_notes.html">
+ packages with notes
</a>
</li>
- {{/include_pkgset_link}}
- <li>Recently tested:<ul class="children">
- <li {{#last_24h}}class='active'{{/last_24h}}>
- <a href="/debian/{{suite}}/{{arch}}/index_last_24h.html">
- packages tested in the last 24h
- </a>
- </li>
- <li {{#last_48h}}class='active'{{/last_48h}}>
- <a href="/debian/{{suite}}/{{arch}}/index_last_48h.html">
- packages tested in the last 48h
- </a>
- </li>
- </ul></li>
- <li {{#all_abc}}class='active'{{/all_abc}}>
- <a href="/debian/{{suite}}/{{arch}}/index_all_abc.html">
- all tested packages (sorted alphabetically)
+ <li {{#no_notes}}class='active'{{/no_notes}}>
+ <a href="/debian/{{suite}}/{{arch}}/index_no_notes.html">
+ packages without notes
</a>
</li>
</ul></li>
- <li>Architectures:<ul class="children">
+ <li>Package states:<ul class="children">
<li>
- {{#arch_list}}
- <a href="/debian/{{suite}}/index_suite_{{a}}_stats.html">{{a}}</a>
- {{/arch_list}}
- </li>
- <li {{#scheduled}}class='active'{{/scheduled}}>
- <a href="/debian/index_{{arch}}_scheduled.html">currently scheduled</a>
+ <a href="/debian/{{suite}}/{{arch}}/index_reproducible.html" target="_parent">
+ <img src="/static/weather-clear.png" alt="reproducible icon" />
+ </a>
+ <a href="/debian/{{suite}}/{{arch}}/index_FTBR.html" target="_parent">
+ <img src="/static/weather-showers-scattered.png" alt="FTBR icon" />
+ </a>
+ <a href="/debian/{{suite}}/{{arch}}/index_FTBFS.html" target="_parent">
+ <img src="/static/weather-storm.png" alt="FTBFS icon" />
+ </a>
+ <a href="/debian/{{suite}}/{{arch}}/index_depwait.html" target="_parent">
+ <img src="/static/weather-snow.png" alt="depwait icon" />
+ </a>
+ <a href="/debian/{{suite}}/{{arch}}/index_not_for_us.html" target="_parent">
+ <img src="/static/weather-few-clouds-night.png" alt="not_for_us icon" />
+ </a>
+ <a href="/debian/{{suite}}/{{arch}}/index_404.html" target="_parent">
+ <img src="/static/weather-severe-alert.png" alt="404 icon" />
+ </a>
+ <a href="/debian/{{suite}}/{{arch}}/index_blacklisted.html" target="_parent">
+ <img src="/static/error.png" alt="blacklisted icon" />
+ </a>
</li>
</ul></li>
- <li>Suites:<ul class="children">
- <li>
- {{#suite_list}}
- <a href="/debian/{{s}}/index_suite_{{arch}}_stats.html">{{s}}</a>
- {{/suite_list}}
+ {{#include_pkgset_link}}
+ <li {{#pkg_set}}class='active'{{/pkg_set}}>
+ <a href="/debian/{{suite}}/{{arch}}/index_pkg_sets.html">
+ package sets
+ </a>
+ </li>
+ {{/include_pkgset_link}}
+ <li>Recently tested:<ul class="children">
+ <li {{#last_24h}}class='active'{{/last_24h}}>
+ <a href="/debian/{{suite}}/{{arch}}/index_last_24h.html">
+ packages tested in the last 24h
+ </a>
</li>
- <li {{#dd_list}}class='active'{{/dd_list}}>
- <a href="/debian/{{suite}}/index_dd-list.html">
- maintainers of unreproducible packages
+ <li {{#last_48h}}class='active'{{/last_48h}}>
+ <a href="/debian/{{suite}}/{{arch}}/index_last_48h.html">
+ packages tested in the last 48h
</a>
</li>
</ul></li>
- <li><a href="{{debian_url}}">Debian dashboard</a>
- <ul class="children">
- <li {{#issues}}class='active'{{/issues}}>
- <a href="/debian/index_issues.html">issues</a>
- </li>
- <li><a href="/debian/index_repositories.html">
- repositories overview</a></li>
- <li {{#notify}}class='active'{{/notify}}>
- <a href="/debian/index_notify.html" title="notify icon">
- ⚑ packages with enabled notifications
- </a>
- </li>
- <li><a href="/debian/index_performance.html">performance stats</a></li>
- <li><a href="/debian/index_variations.html">variations tested</a></li>
- <li {{#breakages}}class='active'{{/breakages}}>
- <a href="/debian/index_breakages.html">broken pieces</a>
- </li>
- </ul></li>
- </ul>
- {{{project_links_html}}}
-</header>
+ <li {{#all_abc}}class='active'{{/all_abc}}>
+ <a href="/debian/{{suite}}/{{arch}}/index_all_abc.html">
+ all tested packages (sorted alphabetically)
+ </a>
+ </li>
+ </ul></li>
+ <li>Architectures:<ul class="children">
+ <li>
+ {{#arch_list}}
+ <a {{{class}}} href="/debian/{{suite}}/index_suite_{{a}}_stats.html">
+ {{a}}
+ </a>
+ {{/arch_list}}
+ </li>
+ <li {{#scheduled}}class='active'{{/scheduled}}>
+ <a href="/debian/index_{{arch}}_scheduled.html">currently scheduled</a>
+ </li>
+ </ul></li>
+ <li>Suites:<ul class="children">
+ <li>
+ {{#suite_list}}
+ <a {{{class}}} href="/debian/{{s}}/index_suite_{{arch}}_stats.html">
+ {{s}}
+ </a>
+ {{/suite_list}}
+ </li>
+ <li {{#dd_list}}class='active'{{/dd_list}}>
+ <a href="/debian/{{suite}}/index_dd-list.html">
+ maintainers of unreproducible packages
+ </a>
+ </li>
+ </ul></li>
+ <li><a {{#dashboard}}class='active'{{/dashboard}} href="{{debian_url}}">Debian dashboard</a>
+ <ul class="children">
+ <li {{#issues}}class='active'{{/issues}}>
+ <a href="/debian/index_issues.html">issues</a>
+ </li>
+ <li {{#repositories}}class='active'{{/repositories}}>
+ <a href="/debian/index_repositories.html">
+ repositories overview
+ </a>
+ </li>
+ <li {{#notify}}class='active'{{/notify}}>
+ <a href="/debian/index_notify.html" title="notify icon">
+ ⚑ packages with enabled notifications
+ </a>
+ </li>
+ <li {{#performance}}class='active'{{/performance}}>
+ <a href="/debian/index_performance.html">performance stats</a>
+ </li>
+ <li {{#variations}}class='active'{{/variations}}>
+ <a href="/debian/index_variations.html">variations tested</a>
+ </li>
+ <li {{#breakages}}class='active'{{/breakages}}>
+ <a href="/debian/index_breakages.html">broken pieces</a>
+ </li>
+ </ul></li>
+</ul>
+{{{project_links_html}}}