From 88c565468c0c8bd7ef2cfefa66b88451d55fbb1a Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 13 Mar 2015 17:34:33 +0100 Subject: reproducible: handle race conditions gracefully --- bin/reproducible_build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 8750f789..f8efd220 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -148,6 +148,7 @@ else SRCPKGID=$(echo $RESULT|cut -d "|" -f2) SRCPACKAGE=$(echo $RESULT|cut -d "|" -f3) SCHEDULED_DATE=$(echo $RESULT|cut -d "|" -f4) + create_results_dirs echo "=============================================================================" echo "Trying to reproducibly build ${SRCPACKAGE} in ${SUITE} on ${ARCH} now." echo "=============================================================================" @@ -157,7 +158,6 @@ else DURATION=0 # mark build attempt sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO schedule (package_id, date_scheduled, date_build_started) VALUES ('$SRCPKGID', '$SCHEDULED_DATE', '$DATE');" - create_results_dirs RBUILDLOG=/var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_None.rbuild.log echo "Starting to build ${SRCPACKAGE}/${SUITE} on $DATE" | tee ${RBUILDLOG} @@ -191,7 +191,7 @@ else # preserve RBUILDLOG as TMPLOG, then cleanup userContent from previous builds, # and then access RBUILDLOG with it's correct name (=eversion) TMPLOG=$(mktemp) - mv ${RBUILDLOG} ${TMPLOG} + mv ${RBUILDLOG} ${TMPLOG} || { echo "Warning, package ${SRCPACKAGE} in ${SUITE} on ${ARCH} is probably already building elsewhere, exiting." ; echo "Warning, package ${SRCPACKAGE} in ${SUITE} on ${ARCH} is probably already building elsewhere, exiting." | mail -s "race condition found" qa-jenkins-scm@lists.alioth.debian.org ; exit 0 } cleanup_userContent RBUILDLOG=/var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_${EVERSION}.rbuild.log mv ${TMPLOG} ${RBUILDLOG} -- cgit v1.2.3-70-g09d2