#!/bin/bash # Copyright 2014-2015 Holger Levsen # © 2015 Mattia Rizzolo # 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 these architectures ARCHS="sparc64 amd64" cleanup_tmpdirs() { cd rm -r $TMPDIR rm -r $TMPBUILDDIR } create_results_dirs() { mkdir -p $BASE/netbsd/dbd } save_netbsd_results(){ local RUN=$1 local ARCH cd obj/releasedir/ for ARCH in $ARCHS ; do mkdir -p $TMPDIR/$RUN/${ARCH} cp -pr ${ARCH} $TMPDIR/$RUN/ rm ./${ARCH} -r done cd ../.. } # # 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 mv src netbsd 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 for ARCH in $ARCHS ; do ionice -c 3 nice \ ./build.sh -j $NUM_CPU -U -u -m ${ARCH} release done # save results in b1 save_netbsd_results b1 echo "=============================================================================" echo "$(date -u) - Building netbsd ${NETBSD_VERSION} - cleaning up between builds." echo "=============================================================================" rm obj/releasedir -r rm obj/destdir.* -r # we keep the toolchain(s) 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) for ARCH in $ARCHS ; do ionice -c 3 nice \ linux64 --uname-2.6 \ ./build.sh -j $NEW_NUM_CPU -U -u -m ${ARCH} release done # 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 "