From 1592fff49e7b73d3b79ea745d5276603f49800e4 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sat, 6 Jun 2015 18:54:10 +0200 Subject: reproducible coreboot: refactor and cleanup --- bin/reproducible_coreboot.sh | 111 +++++++++++-------------------------------- 1 file changed, 29 insertions(+), 82 deletions(-) (limited to 'bin/reproducible_coreboot.sh') diff --git a/bin/reproducible_coreboot.sh b/bin/reproducible_coreboot.sh index 9fd0dc28..03c6f730 100755 --- a/bin/reproducible_coreboot.sh +++ b/bin/reproducible_coreboot.sh @@ -17,7 +17,8 @@ set -e ARCHS="i386" cleanup_all() { - rm -r $TMPDIR + cd + rm -r $TMPDIR } create_results_dirs() { @@ -78,61 +79,16 @@ call_debbindiff() { esac } -build_rebuild() { - FTBFS=1 - local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR) - local NUM_CPU=$(cat /proc/cpuinfo |grep ^processor|wc -l) - set -x - printf "BUILDUSERID=1111\nBUILDUSERNAME=pbuilder1\n" > $TMPCFG - ( timeout -k 12h 12h nice ionice -c 3 sudo \ - DEB_BUILD_OPTIONS="parallel=$NUM_CPU" \ - TZ="/usr/share/zoneinfo/Etc/GMT+12" \ - pbuilder --build \ - --configfile $TMPCFG \ - --debbuildopts "-b" \ - --basetgz /var/cache/pbuilder/$SUITE-reproducible-base.tgz \ - --buildresult b1 \ - ${SRCPACKAGE}_*.dsc \ - ) 2>&1 - if ! "$DEBUG" ; then set +x ; fi - if [ -f b1/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes ] ; then - # the first build did not FTBFS, try rebuild it. - echo "=============================================================================" - echo "Re-building ${SRCPACKAGE}/${VERSION} in ${SUITE} on ${ARCH} now." - echo "=============================================================================" - set -x - printf "BUILDUSERID=2222\nBUILDUSERNAME=pbuilder2\n" > $TMPCFG - ( timeout -k 12h 12h nice ionice -c 3 sudo \ - DEB_BUILD_OPTIONS="parallel=$(echo $NUM_CPU-1|bc)" \ - TZ="/usr/share/zoneinfo/Etc/GMT-14" \ - LANG="fr_CH.UTF-8" \ - LC_ALL="fr_CH.UTF-8" \ - /usr/bin/linux64 --uname-2.6 \ - /usr/bin/unshare --uts -- \ - /usr/sbin/pbuilder --build \ - --configfile $TMPCFG \ - --hookdir /etc/pbuilder/rebuild-hooks \ - --debbuildopts "-b" \ - --basetgz /var/cache/pbuilder/$SUITE-reproducible-base.tgz \ - --buildresult b2 \ - ${SRCPACKAGE}_${EVERSION}.dsc - ) 2>&1 - if ! "$DEBUG" ; then set +x ; fi - if [ -f b2/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes ] ; then - # both builds were fine, i.e., they did not FTBFS. - FTBFS=0 - cat b1/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes - else - echo "The second build failed, even though the first build was successful." - fi - fi - rm $TMPCFG - if [ $FTBFS -eq 1 ] ; then handle_ftbfs ; fi -} - +# FIXME: include these variations +#build_rebuild() { +#( timeout -k 12h 12h nice ionice -c 3 sudo \ +# printf "BUILDUSERID=2222\nBUILDUSERNAME=pbuilder2\n" > $TMPCFG +# /usr/bin/linux64 --uname-2.6 \ +# /usr/bin/unshare --uts -- \ +# --hookdir /etc/pbuilder/rebuild-hooks \ # -# below is what controls the world +# main # TMPDIR=$(mktemp --tmpdir=/srv/reproducible-results -d) # where everything actually happens @@ -148,7 +104,7 @@ echo "$(date -u) - Cloning the coreboot git repository with submodules now." echo "=============================================================================" git clone --recursive http://review.coreboot.org/p/coreboot.git cd coreboot -# still required because the coreboot moved submodule and take care of old git versions +# still required because coreboot moved submodules and to take care of old git versions git submodule update --init --checkout 3rdparty/blobs COREBOOT="$(git log -1 | head -3)" @@ -169,7 +125,7 @@ sed -i 's#MAKE=$i#MAKE=make#' util/abuild/abuild NUM_CPU=$(cat /proc/cpuinfo |grep ^processor|wc -l) sed -i "s#cpus=1#cpus=$NUM_CPU#" util/abuild/abuild # actually build everything -bash util/abuild/abuild || true +bash util/abuild/abuild || true # don't fail the full job just because some targets fail cd coreboot-builds for i in * ; do @@ -190,7 +146,7 @@ export LC_ALL="fr_CH.UTF-8" # use allmost all cores for second build NEW_NUM_CPU=$(echo $NUM_CPU-1|bc) sed -i "s#cpus=$NUM_CPU#cpus=$NEW_NUM_CPU#" util/abuild/abuild -bash util/abuild/abuild || true +bash util/abuild/abuild || true # don't fail the full job just because some targets fail export LANG="en_GB.UTF-8" unset LC_ALL @@ -204,11 +160,8 @@ for i in * ; do fi done cd .. -rm coreboot-builds -rf - -# remove coreboot tree, we don't need it anymore... +rm coreboot-builds -r cd .. -rm coreboot -rf TIMEOUT="30m" DBDSUITE="unstable" @@ -216,11 +169,9 @@ DBDVERSION="$(schroot --directory /tmp -c source:jenkins-reproducible-${DBDSUITE echo "=============================================================================" echo "$(date -u) - Running $DBDVERSION on coreboot images now" echo "=============================================================================" - -create_results_dirs -# FIXME: should not update inplace but in $(mktemp) -PAGE=$BASE/coreboot/coreboot.html -cat > PAGE <<- EOF +# and creating the webpage while we're at it +PAGE=coreboot/coreboot.html +cat > $PAGE <<- EOF @@ -239,44 +190,40 @@ cat > PAGE <<- EOF
EOF -echo "

Reproducible Coreboot

This is work in progress - only TZ, LANG, LC_CTYPE variable and number of cores variations yet and no fancy html.

" > $PAGE
-echo -n $COREBOOT >> $PAGE
-echo "       

$RROMS ($PERCENT%) out of $ROMS built coreboot images were reproducible.

" +cat >> $PAGE <<- EOF EOF cd .. -echo "Enjoy $REPRODUCIBLE_URL/coreboot/coreboot.html" - -#build_rebuild # defines FTBFS -#if [ $FTBFS -eq 0 ] ; then -# call_debbindiff # defines DBDVERSION, update_db_and_html defines STATUS -#fi +publish_page +# the end calculate_build_duration print_out_duration -cd .. +# remove coreboot tree, we don't need it anymore... +rm coreboot -r cleanup_all trap - INT TERM EXIT - -- cgit v1.2.3-54-g00ecf