From d659f111892b9438472f5d440552bf8ea9f977e5 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 4 Nov 2015 00:10:58 +0100 Subject: reproducible freebsd: build master branch too --- TODO | 1 - bin/reproducible_freebsd.sh | 267 +++++++++++++++++++++++--------------------- 2 files changed, 137 insertions(+), 131 deletions(-) diff --git a/TODO b/TODO index 50353c05..78324a32 100644 --- a/TODO +++ b/TODO @@ -253,7 +253,6 @@ properties: ==== reproducible FreeBSD * useful improvements: -** build master branch in addition to release/10.2.0 ** investigate how to use tmpfs on freebsd and build there ** find a way to be informed about updates and keep it updated ** modify PATH, uid, gid and USER too and host+domainname as well. The VM is only used for this, so we could change the host+domainname temporaily between builds too. diff --git a/bin/reproducible_freebsd.sh b/bin/reproducible_freebsd.sh index c8e135e0..bfd1a586 100755 --- a/bin/reproducible_freebsd.sh +++ b/bin/reproducible_freebsd.sh @@ -41,123 +41,125 @@ save_freebsd_results(){ # # main # -FREEBSD_TARGET="release/10.2.0" -RSSH="ssh freebsd-jenkins.debian.net" -RSCP="scp -r freebsd-jenkins.debian.net" -TMPBUILDDIR=/usr/src -$RSSH 'sudo rm -rf /usr/src ; sudo mkdir /usr/src ; sudo chown jenkins /usr/src' ### this is tmpfs on linux, we should move this to tmpfs on FreeBSD too -TMPDIR=$($RSSH 'TMPDIR=/srv/reproducible-results mktemp -d') # used to compare results -DATE=$(date -u +'%Y-%m-%d') -START=$(date +'%s') -trap cleanup_tmpdirs INT TERM EXIT -echo "=============================================================================" -echo "$(date -u) - FreeBSD host info" -echo "=============================================================================" -$RSSH freebsd-version +FREEBSD_TARGETS="master release/10.2.0" +# arrarys to save results +declare -A ALL_FILES +declare -A GOOD_FILES +declare -A GOOD_PERCENT +declare -A FREEBSD +declare -A FILES_HTML +for FREEBSD_TARGET in ${FREEBSD_TARGETS} ;do + RSSH="ssh freebsd-jenkins.debian.net" + RSCP="scp -r freebsd-jenkins.debian.net" + TMPBUILDDIR=/usr/src + $RSSH 'sudo rm -rf /usr/src ; sudo mkdir /usr/src ; sudo chown jenkins /usr/src' ### this is tmpfs on linux, we should move this to tmpfs on FreeBSD too + TMPDIR=$($RSSH 'TMPDIR=/srv/reproducible-results mktemp -d') # used to compare results + DATE=$(date -u +'%Y-%m-%d') + START=$(date +'%s') + trap cleanup_tmpdirs INT TERM EXIT + echo "=============================================================================" + echo "$(date -u) - FreeBSD host info" + echo "=============================================================================" + $RSSH freebsd-version -echo "=============================================================================" -echo "$(date -u) - Cloning FreeBSD git repository." -echo "=============================================================================" -$RSSH git clone --depth 1 --branch $FREEBSD_TARGET https://github.com/freebsd/freebsd.git $TMPBUILDDIR -FREEBSD=$($RSSH "cd $TMPBUILDDIR ; git log -1") -FREEBSD_VERSION=$($RSSH "cd $TMPBUILDDIR ; git describe --always") -echo "This is FreeBSD $FREEBSD_VERSION." -echo -$RSSH "cd $TMPBUILDDIR ; git log -1" -TARGET_NAME=$(echo "freebsd_${FREEBSD_TARGET}_git${FREEBSD_VERSION}" | sed "s#/#-#g") + echo "=============================================================================" + echo "$(date -u) - Cloning FreeBSD git repository." + echo "=============================================================================" + $RSSH git clone --depth 1 --branch $FREEBSD_TARGET https://github.com/freebsd/freebsd.git $TMPBUILDDIR + FREEBSD[$FREEBSD_TARGET]=$($RSSH "cd $TMPBUILDDIR ; git log -1") + FREEBSD_VERSION=$($RSSH "cd $TMPBUILDDIR ; git describe --always") + echo "This is FreeBSD $FREEBSD_VERSION." + echo + $RSSH "cd $TMPBUILDDIR ; git log -1" + TARGET_NAME=$(echo "freebsd_${FREEBSD_TARGET}_git${FREEBSD_VERSION}" | sed "s#/#-#g") -echo "=============================================================================" -echo "$(date -u) - Building FreeBSD ${FREEBSD_VERSION} - first build run." -echo "=============================================================================" -export TZ="/usr/share/zoneinfo/Etc/GMT+12" -export LANG="en_GB.UTF-8" -# actually build everything -NUM_CPU=4 # if someone could tell me how to determine this on FreeBSD, this would be neat -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG sudo make -j $NUM_CPU buildworld" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG sudo make -j $NUM_CPU buildkernel" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG DESTDIR=$TMPDIR sudo make -j $NUM_CPU installworld" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG DESTDIR=$TMPDIR sudo make -j $NUM_CPU installkernel" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG DESTDIR=$TMPDIR sudo make -j $NUM_CPU distribution" -# save results in b1 -save_freebsd_results b1 - -# set time forward 400 days -$RSSH "service ntpd stop ; date --set='+400 days' ; date" -echo "$(date) - system is running in the future now." + echo "=============================================================================" + echo "$(date -u) - Building FreeBSD ${FREEBSD_VERSION} - first build run." + echo "=============================================================================" + export TZ="/usr/share/zoneinfo/Etc/GMT+12" + export LANG="en_GB.UTF-8" + # actually build everything + NUM_CPU=4 # if someone could tell me how to determine this on FreeBSD, this would be neat + $RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG sudo make -j $NUM_CPU buildworld" + $RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG sudo make -j $NUM_CPU buildkernel" + $RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG DESTDIR=$TMPDIR sudo make -j $NUM_CPU installworld" + $RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG DESTDIR=$TMPDIR sudo make -j $NUM_CPU installkernel" + $RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG DESTDIR=$TMPDIR sudo make -j $NUM_CPU distribution" + # save results in b1 + save_freebsd_results b1 + + # set time forward 400 days + $RSSH "service ntpd stop ; date --set='+400 days' ; date" + echo "$(date) - system is running in the future now." -echo "=============================================================================" -echo "$(date -u) - Building FreeBSD - 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="$PATH:/i/capture/the/path" -###umask 0002 -# use allmost all cores for second build -NEW_NUM_CPU=$(echo $NUM_CPU-1|bc) -# actually build everything -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG LC_ALL=$LC_ALL sudo make -j $NEW_NUM_CPU buildworld" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG LC_ALL=$LC_ALL sudo make -j $NEW_NUM_CPU buildkernel" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG LC_ALL=$LC_ALL DESTDIR=$TMPDIR sudo make -j $NEW_NUM_CPU installworld" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG LC_ALL=$LC_ALL DESTDIR=$TMPDIR sudo make -j $NEW_NUM_CPU installkernel" -$RSSH "cd $TMPBUILDDIR ; TZ=$TZ LANG=$LANG LC_ALL=$LC_ALL DESTDIR=$TMPDIR sudo make -j $NEW_NUM_CPU distribution" -# save results in b2 -save_freebsd_results b2 - -# set time back to today -$RSSH "ntpdate pool.ntp.org ; service ntpd start ; service ntpd status ; date" -echo "$(date) - system is running at the current date now." - -# 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 - -# run diffoscope on the results -TIMEOUT="30m" -DIFFOSCOPE="$(schroot --directory /tmp -c source:jenkins-reproducible-${DBDSUITE}-diffoscope diffoscope -- --version 2>&1)" -echo "=============================================================================" -echo "$(date -u) - Running $DIFFOSCOPE on FreeBSD build results." -echo "=============================================================================" -FILES_HTML=$(mktemp --tmpdir=$TMPDIR) -echo "