summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_build.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-10-19 00:27:04 +0200
committerHolger Levsen <holger@layer-acht.org>2014-10-19 00:27:04 +0200
commit4b9ca5a62ef1e5ecc7d0cd74ac56311ec73a0f5c (patch)
treecf54579b5623e671d90d64004c4c7f2225f1f876 /bin/reproducible_build.sh
parentb7217b2fee47252c8ee083864ade33c339b5b6f3 (diff)
downloadjenkins.debian.net-4b9ca5a62ef1e5ecc7d0cd74ac56311ec73a0f5c.tar.xz
reproducible: add locking for reproducible schroot creation (which happens daily)
Diffstat (limited to 'bin/reproducible_build.sh')
-rwxr-xr-xbin/reproducible_build.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index d9b558c3..4a7fc84b 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -134,10 +134,29 @@ else
LOGFILE=$(ls ${SRCPACKAGE}_${EVERSION}.dsc)
LOGFILE=$(echo ${LOGFILE%.dsc}.debbindiff.html)
BUILDINFO=${SRCPACKAGE}_${EVERSION}_amd64.buildinfo
+ # the schroot for debbindiff gets updated once a day. wait patiently if that's the case
+ if [ -f $DBDCHROOT_WRITELOCK ] || [ -f $DBDCHROOT_READLOCK ] ; then
+ for i in $(seq 0 100) ; do
+ sleep 15
+ echo "sleeping 15s, debbindiff schroot is locked."
+ if [ ! -f $DBDCHROOT_WRITELOCK ] && [ ! -f $DBDCHROOT_READLOCK ] ; then
+ break
+ fi
+ done
+ if [ -f $DBDCHROOT_WRITELOCK ] || [ -f $DBDCHROOT_READLOCK ] ; then
+ echo "Warning: lock $DBDCHROOT_WRITELOCK or [ -f $DBDCHROOT_READLOCK ] still exists, exiting."
+ exit 1
+ fi
+ else
+ # we create (more) read-lock(s) but stop on write locks...
+ # write locks are only done by the schroot setup job
+ touch $DBDCHROOT_READLOCK
+ fi
( timeout 15m schroot --directory /tmp -c source:jenkins-reproducible-sid debbindiff -- --html $TMPDIR/${LOGFILE} $TMPDIR/b1/${SRCPACKAGE}_${EVERSION}_amd64.changes $TMPDIR/b2/${SRCPACKAGE}_${EVERSION}_amd64.changes ) 2>&1 >> ${RBUILDLOG}
RESULT=$?
set +x
set -e
+ rm -f $DBDCHROOT_READLOCK
echo | tee -a ${RBUILDLOG}
if [ $RESULT -eq 124 ] ; then
echo "$(date) - debbindiff was killed after running into timeouot... maybe there is still $JENKINS_URL/userContent/dbd/${LOGFILE}" | tee -a ${RBUILDLOG}