[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible NetBSD: add job and initial script, atm only testing sparc64

Holger Levsen holger at moszumanska.debian.org
Sun Jul 5 12:45:45 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 0cf31460831e3f9e26ae7c44df45682be8fd58bc
Author: Holger Levsen <holger at layer-acht.org>
Date:   Sun Jul 5 14:44:48 2015 +0200

    reproducible NetBSD: add job and initial script, atm only testing sparc64
---
 TODO                                           |   8 +-
 bin/reproducible_common.sh                     |  50 ++++++-
 bin/reproducible_netbsd.sh                     | 188 +++++++++++++++++++++++++
 bin/reproducible_openwrt.sh                    |  47 +------
 etc/apache2/sites-available/jenkins.debian.net |   6 +
 job-cfg/reproducible.yaml                      |  13 +-
 6 files changed, 260 insertions(+), 52 deletions(-)

diff --git a/TODO b/TODO
index 34eabfe..d2a2eb4 100644
--- a/TODO
+++ b/TODO
@@ -264,10 +264,10 @@ properties:
 
 ==== reproducible netbsd
 
-* should be fairly easy and similar to openwrt:
-** checkout from cvs
-** run build.sh
-** compare results
+* make it work
+* use NetBSD css and logo
+* link from dashboard
+* announce on their list
 
 ==== reproducible fedora
 
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index fced598..98301e7 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -224,9 +224,13 @@ write_page_intro() {
 		local PROJECTNAME="$1"
 		local PROJECTURL="https://review.coreboot.org/p/coreboot.git"
 	elif [ "$1" = "OpenWrt" ] ; then
-		write_page "        <em>Reproducible OpenWrt</em> is an effort to apply this to OpenWrt. Thus each OpenWR target is build twice, with a few varitations added and then the resulting images and packages from the two builds are compared using <a href=\"https://tracker.debian.org/debbindiff\">debbindiff</a>, <em>which currently cannot detect <code>.bin</code> files as squashfs filesystems.</em> Thus the resulting debbindiff output is not nearly as clear as it could be - hopefully this limi [...]
+		write_page "        <em>Reproducible OpenWrt</em> is an effort to apply this to OpenWrt. Thus each OpenWrt target is build twice, with a few varitations added and then the resulting images and packages from the two builds are compared using <a href=\"https://tracker.debian.org/debbindiff\">debbindiff</a>, <em>which currently cannot detect <code>.bin</code> files as squashfs filesystems.</em> Thus the resulting debbindiff output is not nearly as clear as it could be - hopefully this lim [...]
 		local PROJECTNAME="openwrt"
 		local PROJECTURL="git://git.openwrt.org/openwrt.git"
+	elif [ "$1" = "NetBSD" ] ; then
+		write_page "        <em>Reproducible NetBSD</em> is an effort to apply this to NetBSD. Thus each NetBSD target is build twice, with a few varitations added and then the resulting files from the two builds are compared using <a href=\"https://tracker.debian.org/debbindiff\">debbindiff</a>. Please note that the toolchain is not varied at all as the rebuild happens on exactly the same system. More variations are expected to be seen in the wild.</p>"
+		local PROJECTNAME="NetBSD"
+		local PROJECTURL="https://github.com/jsonn/src"
 	fi
 	write_page "       <p>There is a monthly run <a href=\"https://jenkins.debian.net/view/reproducible/job/reproducible_$PROJECTNAME/\">jenkins job</a> to test the <code>master</code> branch of <a href=\"$PROJECTURL\">$PROJECTNAME.git</a>. Currently this job is triggered more often though, because this is still under development and brand new. The jenkins job is simply running <a href=\"http://anonscm.debian.org/cgit/qa/jenkins.debian.net.git/tree/bin/reproducible_$PROJECTNAME.sh\">reprodu [...]
 }
@@ -235,6 +239,8 @@ write_page_footer() {
 	write_page "<hr/><p style=\"font-size:0.9em;\">There is more information <a href=\"$JENKINS_URL/userContent/about.html\">about jenkins.debian.net</a> and about <a href=\"https://wiki.debian.org/ReproducibleBuilds\"> reproducible builds of Debian</a> available elsewhere. Last update: $(date +'%Y-%m-%d %H:%M %Z'). Copyright 2014-2015 <a href=\"mailto:holger at layer-acht.org\">Holger Levsen</a> and others, GPL2 licensed. The weather icons are public domain and have been taken from the <a hre [...]
 	if [ "$1" = "coreboot" ] ; then
 		write_page "The <a href=\"http://www.coreboot.org\">Coreboot</a> 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."
 	fi
 	write_page "</p></body></html>"
 }
@@ -363,3 +369,45 @@ irc_message() {
 	kgb-client --conf /srv/jenkins/kgb/debian-reproducible.conf --relay-msg "$MESSAGE" || true # don't fail the whole job
 }
 
+call_debbindiff_on_any_file() {
+	mkdir -p $TMPDIR/$1/$(dirname $2)
+	local TMPLOG=(mktemp --tmpdir=$TMPDIR)
+	local msg=""
+	set +e
+	( timeout $TIMEOUT schroot \
+		--directory $TMPDIR \
+		-c source:jenkins-reproducible-${DBDSUITE}-debbindiff \
+		debbindiff -- \
+			--html $TMPDIR/$1/$2.html \
+			$TMPDIR/b1/$1/$2 \
+			$TMPDIR/b2/$1/$2 2>&1 \
+	) 2>&1 >> $TMPLOG
+	RESULT=$?
+	if ! "$DEBUG" ; then set +x ; fi
+	set -e
+	cat $TMPLOG # print dbd output
+	rm -f $TMPLOG
+	case $RESULT in
+		0)	echo "$(date -u) - $1/$2 is reproducible, yay!"
+			;;
+		1)
+			echo "$(date -u) - $DBDVERSION found issues, please investigate $1/$2"
+			;;
+		2)
+			msg="$(date -u) - $DBDVERSION had trouble comparing the two builds. Please investigate $1/$2"
+			;;
+		124)
+			if [ ! -s $TMPDIR/$1.html ] ; then
+				msg="$(date -u) - $DBDVERSION produced no output for $1/$2 and was killed after running into timeout after ${TIMEOUT}..."
+			else
+				msg="$DBDVERSION was killed after running into timeout after $TIMEOUT, but there is still $TMPDIR/$1/$2.html"
+			fi
+			;;
+		*)
+			msg="$(date -u) - Something weird happened when running $DBDVERSION on $1/$2 (which exited with $RESULT) and I don't know how to handle it."
+			;;
+	esac
+	if [ ! -z "$msg" ] ; then
+		echo $msg | tee -a $TMPDIR/$1/$2.html
+	fi
+}
diff --git a/bin/reproducible_netbsd.sh b/bin/reproducible_netbsd.sh
new file mode 100755
index 0000000..3d177aa
--- /dev/null
+++ b/bin/reproducible_netbsd.sh
@@ -0,0 +1,188 @@
+#!/bin/bash
+
+# Copyright 2014-2015 Holger Levsen <holger at layer-acht.org>
+#         © 2015 Mattia Rizzolo <mattia at mapreri.org>
+# released under the GPLv=2
+
+DEBUG=false
+. /srv/jenkins/bin/common-functions.sh
+common_init "$@"
+
+# common code defining db access
+. /srv/jenkins/bin/reproducible_common.sh
+
+set -e
+
+# build for different architectures
+ARCHS="sparc64" # FIXME: actually use this...
+
+cleanup_tmpdirs() {
+	cd
+	rm -r $TMPDIR
+	rm -r $TMPBUILDDIR
+}
+
+create_results_dirs() {
+	mkdir -p $BASE/netbsd/dbd
+}
+
+save_netbsd_results(){
+	RUN=$1
+	cd obj/releasedir/sparc64/
+	mkdir -p $TMPDIR/$RUN/
+	cp -pr * $TMPDIR/$RUN/
+	cd ../../..
+	rm obj/releasedir/sparc64/ -r
+}
+
+#
+# main
+#
+TMPBUILDDIR=$(mktemp --tmpdir=/srv/workspace/chroots/ -d -t netbsd-XXXXXXXX)  # used to build on tmpfs
+TMPDIR=$(mktemp --tmpdir=/srv/reproducible-results -d)  # accessable in schroots, used to compare results
+DATE=$(date -u +'%Y-%m-%d')
+START=$(date +'%s')
+trap cleanup_tmpdirs INT TERM EXIT
+
+cd $TMPBUILDDIR
+echo "============================================================================="
+echo "$(date -u) - Cloning the netbsd git repository (which is autosynced with their CVS repository)"
+echo "============================================================================="
+git clone https://github.com/jsonn/src
+cd netbsd
+NETBSD="$(git log -1)"
+NETBSD_VERSION=$(git describe --always)
+echo "This is netbsd $NETBSD_VERSION."
+echo
+git log -1
+
+echo "============================================================================="
+echo "$(date -u) - Building netbsd ${NETBSD_VERSION} - first build run."
+echo "============================================================================="
+export TZ="/usr/share/zoneinfo/Etc/GMT+12"
+# actually build everything
+ionice -c 3 nice \
+	./build.sh -j $NUM_CPU -U -u -m sparc64 release
+# save results in b1
+save_netbsd_results b1
+
+echo "============================================================================="
+echo "$(date -u) - Building netbsd - second build run."
+echo "============================================================================="
+export TZ="/usr/share/zoneinfo/Etc/GMT-14"
+export LANG="fr_CH.UTF-8"
+export LC_ALL="fr_CH.UTF-8"
+export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path"
+export CAPTURE_ENVIRONMENT="I capture the environment"
+umask 0002
+# use allmost all cores for second build
+NEW_NUM_CPU=$(echo $NUM_CPU-1|bc)
+ionice -c 3 nice \
+	linux64 --uname-2.6 \
+	./build.sh -j $NEW_NUM_CPU -U -u -m sparc64 release
+
+# reset environment to default values again
+export LANG="en_GB.UTF-8"
+unset LC_ALL
+export TZ="/usr/share/zoneinfo/UTC"
+export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:"
+umask 0022
+
+# save results in b2
+save_netbsd_results b2
+
+# clean up builddir to save space on tmpfs
+rm -r $TMPBUILDDIR/netbsd
+
+# run debbindiff on the results
+TIMEOUT="30m"
+DBDSUITE="unstable"
+DBDVERSION="$(schroot --directory /tmp -c source:jenkins-reproducible-${DBDSUITE}-debbindiff debbindiff -- --version 2>&1)"
+echo "============================================================================="
+echo "$(date -u) - Running $DBDVERSION on netbsd..."
+echo "============================================================================="
+FILES_HTML=$(mktemp --tmpdir=$TMPDIR)
+echo "       <ul>" > $FILES_HTML
+BAD_FILES=0
+GOOD_FILES=0
+ALL_FILES=0
+create_results_dirs
+cd $TMPDIR/b1
+tree .
+for i in * ; do
+	cd $i
+	echo "       <table><tr><th>Release files for <code>$i</code></th></tr>" >> $FILES_HTML
+	for j in $(find * -type f |sort -u ) ; do
+		let ALL_FILES+=1
+		call_debbindiff_on_any_file $i $j
+		SIZE="$(du -h -b $j | cut -f1)"
+		SIZE="$(echo $SIZE/1024|bc)"
+		if [ -f $TMPDIR/$i/$j.html ] ; then
+			mkdir -p $BASE/netbsd/dbd/$i
+			mv $TMPDIR/$i/$j.html $BASE/netbsd/dbd/$i/$j.html
+			echo "         <tr><td><a href=\"dbd/$i/$j.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $j</a> (${SIZE}K) is unreproducible.</td></tr>" >> $FILES_HTML
+		else
+			SHASUM=$(sha256sum $j|cut -d " " -f1)
+			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, ${SIZE}K) is reproducible.</td></tr>" >> $FILES_HTML
+			let GOOD_FILES+=1
+			rm -f $BASE/netbsd/dbd/$i/$j.html # cleanup from previous (unreproducible) tests - if needed
+		fi
+	done
+	cd ..
+	echo "       </table>" >> $FILES_HTML
+done
+GOOD_PERCENT=$(echo "scale=1 ; ($GOOD_FILES*100/$ALL_FILES)" | bc)
+BAD_PERCENT=$(echo "scale=1 ; ($BAD_FILES*100/$ALL_FILES)" | bc)
+# are we there yet?
+if [ "$GOOD_PERCENT" = "100.0" ] ; then
+	MAGIC_SIGN="!"
+else
+	MAGIC_SIGN="?"
+fi
+
+#
+#  finally create the webpage
+#
+cd $TMPDIR ; mkdir netbsd
+PAGE=netbsd/netbsd.html
+cat > $PAGE <<- EOF
+<!DOCTYPE html>
+<html lang="en-US">
+  <head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width">
+    <title>NetBSD</title>
+    <link rel='stylesheet' id='twentyfourteen-style-css'  href='landing_style.css?ver=4.0' type='text/css' media='all' />
+  </head>
+  <body>
+    <div class="content">
+      <div class="page-content">
+EOF
+write_page "       <h1>Reproducible NetBSD</h1>"
+write_page_intro NetBSD
+write_page "       <p>$GOOD_FILES ($GOOD_PERCENT%) out of $ALL_FILES built netbsd files were reproducible in our test setup"
+if [ "$GOOD_PERCENT" = "100.0" ] ; then
+	write_page "!"
+else
+	write_page ", while $BAD_FILES ($BAD_PERCENT%) failed to build from source."
+fi
+write_page "        These tests were last run on $DATE for version ${NETBSD_VERSION}.</p>"
+write_explaination_table NetBSD
+cat $FILES_HTML >> $PAGE
+write_page "     <p><pre>"
+echo -n "$NETBSD" >> $PAGE
+write_page "     </pre></p>"
+write_page "    </div></div>"
+write_page_footer NetBSD
+publish_page
+rm -f $FILES_HTML 
+
+# the end
+calculate_build_duration
+print_out_duration
+irc_message "$REPRODUCIBLE_URL/netbsd/ has been updated. ($GOOD_PERCENT% reproducible)"
+echo "============================================================================="
+
+# remove everything, we don't need it anymore...
+cleanup_tmpdirs
+trap - INT TERM EXIT
diff --git a/bin/reproducible_openwrt.sh b/bin/reproducible_openwrt.sh
index 4243de7..cc94284 100755
--- a/bin/reproducible_openwrt.sh
+++ b/bin/reproducible_openwrt.sh
@@ -22,49 +22,6 @@ create_results_dirs() {
 	mkdir -p $BASE/openwrt/dbd
 }
 
-call_debbindiff() {
-	mkdir -p $TMPDIR/$1/$(dirname $2)
-	local TMPLOG=(mktemp --tmpdir=$TMPDIR)
-	local msg=""
-	set +e
-	( timeout $TIMEOUT schroot \
-		--directory $TMPDIR \
-		-c source:jenkins-reproducible-${DBDSUITE}-debbindiff \
-		debbindiff -- \
-			--html $TMPDIR/$1/$2.html \
-			$TMPDIR/b1/$1/$2 \
-			$TMPDIR/b2/$1/$2 2>&1 \
-	) 2>&1 >> $TMPLOG
-	RESULT=$?
-	if ! "$DEBUG" ; then set +x ; fi
-	set -e
-	cat $TMPLOG # print dbd output
-	rm -f $TMPLOG
-	case $RESULT in
-		0)	echo "$(date -u) - $1/$2 is reproducible, yay!"
-			;;
-		1)
-			echo "$(date -u) - $DBDVERSION found issues, please investigate $1/$2"
-			;;
-		2)
-			msg="$(date -u) - $DBDVERSION had trouble comparing the two builds. Please investigate $1/$2"
-			;;
-		124)
-			if [ ! -s $TMPDIR/$1.html ] ; then
-				msg="$(date -u) - $DBDVERSION produced no output for $1/$2 and was killed after running into timeout after ${TIMEOUT}..."
-			else
-				msg="$DBDVERSION was killed after running into timeout after $TIMEOUT, but there is still $TMPDIR/$1/$2.html"
-			fi
-			;;
-		*)
-			msg="$(date -u) - Something weird happened when running $DBDVERSION on $1/$2 (which exited with $RESULT) and I don't know how to handle it."
-			;;
-	esac
-	if [ ! -z "$msg" ] ; then
-		echo $msg | tee -a $TMPDIR/$1/$2.html
-	fi
-}
-
 save_openwrt_results(){
 	RUN=$1
 	cd bin
@@ -258,7 +215,7 @@ for i in * ; do
 	echo "       <table><tr><th>Images for <code>$i</code></th></tr>" >> $DBD_HTML
 	for j in $(find * -name "*.bin" -o -name "*.squashfs" |sort -u ) ; do
 		let ALL_IMAGES+=1
-		call_debbindiff $i $j
+		call_debbindiff_on_any_file $i $j
 		SIZE="$(du -h -b $j | cut -f1)"
 		SIZE="$(echo $SIZE/1024|bc)"
 		if [ -f $TMPDIR/$i/$j.html ] ; then
@@ -286,7 +243,7 @@ for i in * ; do
 	echo "       <table><tr><th>Packages for <code>$i</code></th></tr>" >> $DBD_HTML
 	for j in $(find * -name "*.ipk" |sort -u ) ; do
 		let ALL_PACKAGES+=1
-		call_debbindiff $i $j
+		call_debbindiff_on_any_file $i $j
 		SIZE="$(du -h -b $j | cut -f1)"
 		SIZE="$(echo $SIZE/1024|bc)"
 		if [ -f $TMPDIR/$i/$j.html ] ; then
diff --git a/etc/apache2/sites-available/jenkins.debian.net b/etc/apache2/sites-available/jenkins.debian.net
index bd636f7..668bcf3 100644
--- a/etc/apache2/sites-available/jenkins.debian.net
+++ b/etc/apache2/sites-available/jenkins.debian.net
@@ -258,6 +258,12 @@ Use common-debian-service-https-redirect reproducible.debian.net
 	RewriteCond %{REQUEST_URI} ^/openwrt/$
 	RewriteRule ^/(.*) /openwrt/openwrt.html [R,L]
 
+	# redirect /netbsd/ to netbsd/netbsd.html
+	# note: the missing slash in the RewriteRule is wanted to avoid a double slash
+	RewriteCond %{HTTP_HOST} reproducible\.debian\.net
+	RewriteCond %{REQUEST_URI} ^/netbsd/$
+	RewriteRule ^/(.*) /netbsd/netbsd.html [R,L]
+
 	# redirect /issues/ to /index_issues.html
 	RewriteCond %{REQUEST_URI} ^/issues/$
 	RewriteRule ^/(.*) /index_issues.html [R,L]
diff --git a/job-cfg/reproducible.yaml b/job-cfg/reproducible.yaml
index e5eeb15..8e629c6 100644
--- a/job-cfg/reproducible.yaml
+++ b/job-cfg/reproducible.yaml
@@ -277,6 +277,10 @@
     defaults: reproducible_other_projects
     name: '{name}_openwrt'
 
+- job-template:
+    defaults: reproducible_other_projects
+    name: '{name}_netbsd'
+
 - project:
     name: reproducible
     jobs:
@@ -417,13 +421,18 @@
             my_shell: '/srv/jenkins/bin/reproducible_build.sh'
             my_recipients: 'qa-jenkins-scm at lists.alioth.debian.org'
         - '{name}_coreboot':
-            my_description: 'Try to rebuild all coreboot ROMs twice (with variations) and investigate them regarding reproducibility.'
+            my_description: 'Try to rebuild all coreboot ROMs twice (with variations) and investigate regarding reproducibility.'
             my_timed: '23 42 23 * *'
             my_shell: '/srv/jenkins/bin/reproducible_coreboot.sh'
             my_recipients: 'qa-jenkins-scm at lists.alioth.debian.org'
         - '{name}_openwrt':
-            my_description: 'Try to rebuild OpenWrt (some targets, some packages) twice (with variations) and investigate them regarding reproducibility.'
+            my_description: 'Try to rebuild OpenWrt (some targets, some packages) twice (with variations) and investigate regarding reproducibility.'
             my_timed: '23 42 23 * *'
             my_shell: '/srv/jenkins/bin/reproducible_openwrt.sh'
             my_recipients: 'qa-jenkins-scm at lists.alioth.debian.org'
+        - '{name}_netbsd':
+            my_description: 'Try to rebuild NetBSD (some archs) twice (with variations) and investigate regarding reproducibility.'
+            my_timed: '23 42 23 * *'
+            my_shell: '/srv/jenkins/bin/reproducible_netbsd.sh'
+            my_recipients: 'qa-jenkins-scm at lists.alioth.debian.org'
 

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