diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-09-16 19:47:35 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-11-08 16:53:29 +0100 |
commit | 464d96e0aea8158077777ddd42cd2cc3d6bbd01a (patch) | |
tree | bc7caa564a65fc0f094285c31c445e4111adeeae /bin | |
parent | 9a72d34391f87cf7b663733a047e60c3f1e5dcfa (diff) | |
download | jenkins.debian.net-464d96e0aea8158077777ddd42cd2cc3d6bbd01a.tar.xz |
reproducible debian: add and use query_to_print bash function
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_maintenance.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh index e8b79185..5450395a 100755 --- a/bin/reproducible_maintenance.sh +++ b/bin/reproducible_maintenance.sh @@ -14,6 +14,12 @@ common_init "$@" DIRTY=false REP_RESULTS=/srv/reproducible-results + +# query reproducible database, print output +query_to_print() { + printf ".width 0 25 \n $@ ; " | sqlite3 -init $INIT -header -column ${PACKAGES_DB} +} + # backup db if [ "$HOSTNAME" = "$MAINNODE" ] ; then echo "$(date -u) - backup db and update public copy." @@ -256,7 +262,7 @@ if [ "$HOSTNAME" = "$MAINNODE" ] ; then if grep -q '|' $PACKAGES ; then echo echo "Packages found where the build was started more than 48h ago:" - printf ".width 0 25 \n $QUERY ; " | sqlite3 -init $INIT -header -column ${PACKAGES_DB} 2> /dev/null || echo "Warning: SQL query '$QUERY' failed." + query_to_print "$QUERY" 2> /dev/null || echo "Warning: SQL query '$QUERY' failed." echo for PKG in $(cat $PACKAGES | cut -d "|" -f1) ; do echo "sqlite3 ${PACKAGES_DB} \"DELETE FROM schedule WHERE package_id = '$PKG';\"" @@ -281,7 +287,7 @@ if [ "$HOSTNAME" = "$MAINNODE" ] ; then echo echo "Found files relative to old packages, no more in the archive:" echo "Removing these removed packages from database:" - printf ".width 25 12 \n $QUERY ;" | sqlite3 -init $INIT -header -column ${PACKAGES_DB} 2> /dev/null || echo "Warning: SQL query '$QUERY' failed." + query_to_print "$QUERY" 2> /dev/null || echo "Warning: SQL query '$QUERY' failed." echo for pkg in $(cat $PACKAGES) ; do PKGNAME=$(echo "$pkg" | cut -d '|' -f 1) |