diff options
author | Holger Levsen <holger@layer-acht.org> | 2014-10-13 15:26:25 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2014-10-13 15:26:25 +0200 |
commit | a4a856948aee799dd509cf3bdab283c8b676df72 (patch) | |
tree | 75c3326f2dacf87059b94f30b6d093f1089481ae | |
parent | f6952909b7cf96e473d0defdf350f01cbbdfcf63 (diff) | |
download | jenkins.debian.net-a4a856948aee799dd509cf3bdab283c8b676df72.tar.xz |
reproducible: add helper script for manual scheduling
-rwxr-xr-x | bin/reproducible_schedule_on_demand.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/bin/reproducible_schedule_on_demand.sh b/bin/reproducible_schedule_on_demand.sh new file mode 100755 index 00000000..53e2ed3c --- /dev/null +++ b/bin/reproducible_schedule_on_demand.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# Copyright 2014 Holger Levsen <holger@layer-acht.org> +# released under the GPLv=2 + +. /srv/jenkins/bin/common-functions.sh +common_init "$@" + +set +x + +# +# define db +# +PACKAGES_DB=/var/lib/jenkins/reproducible.db +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 + +schedule_packages() { + DATE="2014-10-01 00:23" + TMPFILE=$(mktemp) + for PKG in $PACKAGES ; do + echo "REPLACE INTO sources_scheduled VALUES ('$PKG','$DATE','');" >> $TMPFILE + done + cat $TMPFILE | sqlite3 -init $INIT ${PACKAGES_DB} + rm $TMPFILE + echo "=============================================================================" + echo "The following $TOTAL source packages have been (re-)scheduled: $PACKAGES" + echo "=============================================================================" + echo +} + +check_candidates() { + PACKAGES="" + TOTAL=0 + for PKG in $CANDIDATES ; do + RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT name from sources WHERE name = '$PKG';") + if [ ! -z "$RESULT" ] ; then + PACKAGES="$PACKAGES $RESULT" + let "TOTAL+=1" + fi + done +} + + + +# +# main +# +CANDIDATES="$@" +check_candidates +MESSAGE="$TOTAL package(s) manually (re-)scheduled." + +# finally +schedule_packages +echo +echo "$MESSAGE" +kgb-client --conf /srv/jenkins/kgb/debian-reproducible.conf --relay-msg "$MESSAGE" +echo |