summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-07-05 14:44:48 +0200
committerHolger Levsen <holger@layer-acht.org>2015-07-05 14:44:48 +0200
commit0cf31460831e3f9e26ae7c44df45682be8fd58bc (patch)
tree04fd860deef0af3d71b0e38f035d821c52991a89 /bin
parent3e0393deb8d8769f5aafe231062ba319aad37100 (diff)
downloadjenkins.debian.net-0cf31460831e3f9e26ae7c44df45682be8fd58bc.tar.xz
reproducible NetBSD: add job and initial script, atm only testing sparc64
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_common.sh50
-rwxr-xr-xbin/reproducible_netbsd.sh188
-rwxr-xr-xbin/reproducible_openwrt.sh47
3 files changed, 239 insertions, 46 deletions
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index fced5980..98301e78 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 limitation will be overcome soon. Also 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>"
+ 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 limitation will be overcome soon. Also 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="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\">reproducible_$PROJECTNAME.sh</a> in a Debian environment and this script is solely responsible for creating this page. Feel invited to join <code>#debian-reproducible</code> (on irc.oftc.net) to request job runs whenever sensible. Patches and other <a href=\"mailto:reproducible-builds@lists.alioth.debian.org\">feedback</a> are very much appreciated!</p>"
}
@@ -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@layer-acht.org\">Holger Levsen</a> and others, GPL2 licensed. The weather icons are public domain and have been taken from the <a href="http://tango.freedesktop.org/Tango_Icon_Library" target="_blank">Tango Icon Library</a>."
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 00000000..3d177aac
--- /dev/null
+++ b/bin/reproducible_netbsd.sh
@@ -0,0 +1,188 @@
+#!/bin/bash
+
+# Copyright 2014-2015 Holger Levsen <holger@layer-acht.org>
+# © 2015 Mattia Rizzolo <mattia@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 4243de79..cc94284c 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