From bd64abb89b29d51bb3a243595bc3facec240a2db Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Mon, 13 Oct 2014 07:50:48 +0200 Subject: reproducible: improve db locking, add new table sources_scheduled --- bin/reproducible_build.sh | 7 +++++++ bin/reproducible_setup.sh | 13 +++++++++++++ bin/reproducible_stats.sh | 7 +++++++ 3 files changed, 27 insertions(+) diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 111e16b5..d1c1f5b1 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -12,6 +12,13 @@ INIT=/var/lib/jenkins/reproducible.init if [ ! -f $PACKAGES_DB ] ; then echo "$PACKAGES_DB doesn't exist, no builds possible." exit 1 +elif [ -f $PACKAGES_DB.lock ] ; then + for i in $(seq 0 100) ; do + sleep 15 + [ -f $PACKAGES_DB.lock ] || break + done + echo "$PACKAGES_DB.lock still exist, exiting." + exit 1 fi # create dirs for results diff --git a/bin/reproducible_setup.sh b/bin/reproducible_setup.sh index 50c7ac44..9bd0b341 100755 --- a/bin/reproducible_setup.sh +++ b/bin/reproducible_setup.sh @@ -17,10 +17,23 @@ if [ ! -f ${PACKAGES_DB} ] ; then CHECK (status IN ("blacklisted", "FTBFS","reproducible","unreproducible","404", "not for us")), build_date TEXT NOT NULL, PRIMARY KEY (name))' + sqlite3 ${PACKAGES_DB} ' + CREATE TABLE sources_scheduled + (name TEXT NOT NULL, + date_scheduled TEXT NOT NULL, + date_build_started TEXT NOT NULL, + PRIMARY KEY (name))' sqlite3 ${PACKAGES_DB} ' CREATE TABLE sources (name TEXT NOT NULL, version TEXT NOT NULL)' +elif [ -f $PACKAGES_DB.lock ] ; then + for i in $(seq 0 100) ; do + sleep 15 + [ -f $PACKAGES_DB.lock ] || break + done + echo "$PACKAGES_DB.lock still exist, exiting." + exit 1 fi # 30 seconds timeout when trying to get a lock INIT=/var/lib/jenkins/reproducible.init diff --git a/bin/reproducible_stats.sh b/bin/reproducible_stats.sh index 8a84f8be..933a666d 100755 --- a/bin/reproducible_stats.sh +++ b/bin/reproducible_stats.sh @@ -13,6 +13,13 @@ INIT=/var/lib/jenkins/reproducible.init if [ ! -f $PACKAGES_DB ] ; then echo "$PACKAGES_DB doesn't exist, no stats possible." exit 1 +elif [ -f $PACKAGES_DB.lock ] ; then + for i in $(seq 0 100) ; do + sleep 15 + [ -f $PACKAGES_DB.lock ] || break + done + echo "$PACKAGES_DB.lock still exist, exiting." + exit 1 fi declare -A GOOD -- cgit v1.2.3-70-g09d2