From a8d02c004bb864307c297db5af5e5730d9ee6f9a Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Tue, 5 Jul 2016 08:35:41 -0400 Subject: reproducible debian: replace bash write_page_footer with mustache template Signed-off-by: Mattia Rizzolo Signed-off-by: Holger Levsen --- bin/reproducible_common.sh | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'bin/reproducible_common.sh') diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 651299b3..9e5f38f2 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -42,6 +42,7 @@ REPRODUCIBLE_DOT_ORG_URL=https://reproducible-builds.org JENKINS_URL=${JENKINS_URL:0:-1} DBDSUITE="unstable" BIN_PATH=/srv/jenkins/bin +TEMPLATE_PATH=$BIN_PATH/templates # Debian suites being tested SUITES="testing unstable experimental" @@ -103,6 +104,9 @@ do META_PKGSET[$col1]=$col2 done < $BIN_PATH/meta_pkgset.csv +# mustache templates +PAGE_FOOTER_TEMPLATE=$TEMPLATE_PATH/default_page_footer.mustache + # sleep 1-23 secs to randomize start times delay_start() { /bin/sleep $(echo "scale=1 ; $(shuf -i 1-230 -n 1)/10" | bc ) @@ -367,33 +371,34 @@ write_page_intro() { fi } -# See the python equivalent of this function: reproducible_common.py's create_default_page_footer write_page_footer() { - write_page "

" - if [ -n "$JOB_URL" ] ; then - write_page "This page was built by the jenkins job" - write_page "$(basename $JOB_URL) which is configured" - write_page "via this git repo." - fi - write_page "There is more information about jenkins.debian.net and about reproducible builds of Debian available elsewhere." - write_page "
Last update: $(date +'%Y-%m-%d %H:%M %Z'). Copyright 2014-2016 Holger Levsen and many others." - write_page "The code of jenkins.debian.net.git is mostly GPL-2 licensed. The weather icons are public domain and have been taken from the Tango Icon Library." - write_page "
" if [ "$1" = "coreboot" ] ; then - write_page "The Coreboot logo is Copyright © 2008 by Konsult Stuge and coresystems GmbH and can be freely used to refer to the Coreboot project." + other_distro_details="The Coreboot logo is Copyright © 2008 by Konsult Stuge and coresystems GmbH and can be freely used to refer to the Coreboot project." elif [ "$1" = "NetBSD" ] ; then - write_page "NetBSD® is a registered trademark of The NetBSD Foundation, Inc." + other_distro_details="NetBSD® is a registered trademark of The NetBSD Foundation, Inc." elif [ "$1" = "FreeBSD" ] ; then - write_page "FreeBSD is a registered trademark of The FreeBSD Foundation. The FreeBSD logo and The Power to Serve are trademarks of The FreeBSD Foundation." + other_distro_details="FreeBSD is a registered trademark of The FreeBSD Foundation. The FreeBSD logo and The Power to Serve are trademarks of The FreeBSD Foundation." elif [ "$1" = "Arch Linux" ] ; then - write_page "The Arch Linux name and logo are recognized trademarks. Some rights reserved. The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis." + other_distro_details="The Arch Linux name and logo are recognized trademarks. Some rights reserved. The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis." elif [ "$1" = "fedora-23" ] ; then - write_page "FIXME: add fedora copyright+trademark disclaimers here." + other_distro_details="FIXME: add fedora copyright+trademark disclaimers here." + else + other_distro_details='' fi - write_page "

" + now=$(date +'%Y-%m-%d %H:%M %Z') + + # The context for pystache3 CLI must be json + context=$(printf '{ + "job_url" : "%s", + "job_name" : "%s", + "date" : "%s", + "other_distro_details" : "%s" + }' "${JOB_URL:-""}" "${JOB_NAME:-""}" "$now" "$other_distro_details") + + write_page "$(pystache3 $PAGE_FOOTER_TEMPLATE "$context")" write_page "" write_page "" -} + } # A mustache equivalent of this function has been created. See TEMPLATE_PATH/pkg_list_key.mustache write_page_meta_sign() { -- cgit v1.2.3-70-g09d2