summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-10-18 00:43:40 +0200
committerHolger Levsen <holger@layer-acht.org>2015-10-18 00:43:40 +0200
commitb6be7ad48c498a46383d131a8c1e7ce6fa561dd1 (patch)
treec32a1829bb81d9422d89447fbe2d23d749e8e96c /bin
parent4df9fffbb4e8b7e3bd7d0515a913bcda1e35fbe8 (diff)
downloadjenkins.debian.net-b6be7ad48c498a46383d131a8c1e7ce6fa561dd1.tar.xz
reproducible: make sql queries in update_db_and_html() more robust
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_build.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index f5db33c3..2fe8420a 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -90,12 +90,19 @@ cleanup_all() {
}
update_db_and_html() {
- # everything passed at this function is saved as a status of this package in the db
+ #
+ # as we still experience problems with locked database, in this function
+ # each sqlite command is run as: command || command, thus doubling the chance
+ # each will succeed... (no further comment… it was probably not designed to
+ # accessed by 40 jobs…)
+ #
+ # save everything as status of this package in the db
STATUS="$@"
if [ -z "$VERSION" ] ; then
VERSION="None"
fi
- local OLD_STATUS=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT status FROM results WHERE package_id='${SRCPKGID}'")
+ local OLD_STATUS=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT status FROM results WHERE package_id='${SRCPKGID}'" || \
+ sqlite3 -init $INIT ${PACKAGES_DB} "SELECT status FROM results WHERE package_id='${SRCPKGID}'")
# irc+mail notifications for changing status in unstable and experimental
if [ "$SUITE" != "testing" ] ; then
if [ "${OLD_STATUS}" = "reproducible" ] && [ "$STATUS" != "depwait" ] && \
@@ -116,11 +123,14 @@ update_db_and_html() {
echo "$(date -u +'%Y-%m-%d %H:%M') $REPRODUCIBLE_URL/$SUITE/$ARCH/$SRCPACKAGE changed from $OLD_STATUS -> $STATUS" >> /srv/reproducible-results/notification-emails/$SRCPACKAGE
fi
fi
+ sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration, builder) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$BUILDER')" || \
sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration, builder) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$BUILDER')"
if [ ! -z "$DURATION" ] ; then # this happens when not 404 and not_for_us
+ sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, builder) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$BUILDER')" || \
sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, builder) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$BUILDER')"
fi
# unmark build since it's properly finished
+ sqlite3 -init $INIT ${PACKAGES_DB} "DELETE FROM schedule WHERE package_id='$SRCPKGID';" || \
sqlite3 -init $INIT ${PACKAGES_DB} "DELETE FROM schedule WHERE package_id='$SRCPKGID';"
gen_package_html $SRCPACKAGE
echo