From 53bf0e766988c9fa6e6f2d2db15bd2927667fab6 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 11 Jun 2015 19:31:47 +0200 Subject: reproducible: refactor --- bin/reproducible_build.sh | 16 ++++++++++------ bin/reproducible_common.sh | 3 ++- bin/reproducible_coreboot.sh | 1 - 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 539d4ecb..8aee48a3 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -372,11 +372,8 @@ check_suitability() { if ! $SUITABLE ; then handle_not_for_us $ARCHITECTURES ; fi } -build_rebuild() { - FTBFS=1 +first_build(){ local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR) - local NUM_CPU=$(cat /proc/cpuinfo |grep '^processor'|wc -l) - mkdir b1 b2 set -x printf "BUILDUSERID=1111\nBUILDUSERNAME=pbuilder1\n" > $TMPCFG ( timeout -k 12h 12h nice ionice -c 3 sudo \ @@ -390,6 +387,13 @@ build_rebuild() { ${SRCPACKAGE}_*.dsc \ ) 2>&1 | tee -a $RBUILDLOG if ! "$DEBUG" ; then set +x ; fi + rm $TMPCFG +} + +build_rebuild() { + FTBFS=1 + mkdir b1 b2 + first_build if [ -f b1/${SRCPACKAGE}_${EVERSION}_${ARCH}.changes ] ; then # the first build did not FTBFS, try rebuild it. check_for_race_conditions @@ -397,6 +401,7 @@ build_rebuild() { echo "Re-building ${SRCPACKAGE}/${VERSION} in ${SUITE} on ${ARCH} now." echo "=============================================================================" set -x + local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR) 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)" \ @@ -421,14 +426,13 @@ build_rebuild() { else echo "The second build failed, even though the first build was successful." | tee -a ${RBUILDLOG} fi + rm $TMPCFG fi cleanup_userContent update_rbuildlog - rm $TMPCFG if [ $FTBFS -eq 1 ] ; then handle_ftbfs ; fi } - # # below is what controls the world # diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 84df5d85..b0db0803 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -41,6 +41,8 @@ JENKINS_URL=${JENKINS_URL:0:-1} SUITES="testing unstable experimental" # arches being tested ARCHES="amd64" +# number of cores to be used +NUM_CPU=$(grep -c '^processor' /proc/cpuinfo) # existing usertags USERTAGS="toolchain infrastructure timestamps fileordering buildpath username hostname uname randomness buildinfo cpu signatures environment umask" @@ -270,7 +272,6 @@ write_explaination_table() { write_page "env LANGLANG=\"en_GB.UTF-8\"LANG=\"fr_CH.UTF-8\"" write_page "env LC_ALLunsetLC_ALL=\"fr_CH.UTF-8\"" write_page "env PATHPATH=\"/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:\"PATH=\"/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path\"" - local NUM_CPU=$(cat /proc/cpuinfo |grep '^processor'|wc -l) if [ "$1" = "debian" ] ; then write_page "env BUILDUSERIDBUILDUSERID=\"1111\"BUILDUSERID=\"2222\"" write_page "env BUILDUSERNAMEBUILDUSERNAME=\"pbuilder1\"BUILDUSERNAME=\"pbuilder2\"" diff --git a/bin/reproducible_coreboot.sh b/bin/reproducible_coreboot.sh index 2e8d0f44..c39771cf 100755 --- a/bin/reproducible_coreboot.sh +++ b/bin/reproducible_coreboot.sh @@ -91,7 +91,6 @@ COREBOOT_VERSION=$(git describe) echo "This is coreboot $COREBOOT_VERSION." echo git log -1 -NUM_CPU=$(cat /proc/cpuinfo |grep '^processor'|wc -l) echo "=============================================================================" echo "$(date -u) - Building cross compilers for ${ARCHS} now." -- cgit v1.2.3-54-g00ecf