From b4d6ef23a889ec37b539bbc06311efe8a680bd96 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Mon, 6 Apr 2015 00:31:58 +0200 Subject: reproducible: build: refactor: more trimming of the main function + fix variable declaration order --- bin/reproducible_build.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 0947e285..5ba241fd 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -192,6 +192,8 @@ init() { echo "=============================================================================" # mark build attempt sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO schedule (package_id, date_scheduled, date_build_started) VALUES ('$SRCPKGID', '$SCHEDULED_DATE', '$DATE');" + echo "Starting to build ${SRCPACKAGE}/${SUITE} on $DATE" | tee ${RBUILDLOG} + echo "The jenkins build log is/was available at $BUILD_URL/console" | tee -a ${RBUILDLOG} } get_source_package() { @@ -216,26 +218,23 @@ TMPCFG=$(mktemp -t pbuilderrc_XXXX) trap cleanup_all INT TERM EXIT cd $TMPDIR -# global variables (this is what we expect, at least. if something goes wrong, then something failed) -RBUILDLOG=/var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_None.rbuild.log -DBDREPORT=$(echo ${SRCPACKAGE}_${EVERSION}.debbindiff.html) -BUILDINFO=${SRCPACKAGE}_${EVERSION}_${ARCH}.buildinfo DATE=$(date +'%Y-%m-%d %H:%M') START=$(date +'%s') - choose_package + +RBUILDLOG=/var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_None.rbuild.log +DBDREPORT=$(echo ${SRCPACKAGE}_${EVERSION}.debbindiff.html) +BUILDINFO=${SRCPACKAGE}_${EVERSION}_${ARCH}.buildinfo + init +get_source_package + +VERSION=$(grep "^Version: " ${SRCPACKAGE}_*.dsc| head -1 | egrep -v '(GnuPG v|GnuPG/MacGPG2)' | cut -d " " -f2-) +EVERSION=$(echo $VERSION | cut -d ":" -f2) # EPOCH_FREE_VERSION was too long - echo "Starting to build ${SRCPACKAGE}/${SUITE} on $DATE" | tee ${RBUILDLOG} - echo "The jenkins build log is/was available at $BUILD_URL/console" | tee -a ${RBUILDLOG} - set +e - get_source_package - VERSION=$(grep "^Version: " ${SRCPACKAGE}_*.dsc| head -1 | egrep -v '(GnuPG v|GnuPG/MacGPG2)' | cut -d " " -f2-) - # EPOCH_FREE_VERSION was too long - EVERSION=$(echo $VERSION | cut -d ":" -f2) # preserve RBUILDLOG as TMPLOG, then cleanup userContent from previous builds, # and then access RBUILDLOG with it's correct name (=eversion) TMPLOG=$(mktemp) -- cgit v1.2.3-70-g09d2