From 464d96e0aea8158077777ddd42cd2cc3d6bbd01a Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Fri, 16 Sep 2016 19:47:35 -0400 Subject: reproducible debian: add and use query_to_print bash function Signed-off-by: Mattia Rizzolo Signed-off-by: Holger Levsen --- bin/reproducible_maintenance.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bin') 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) -- cgit v1.2.3-70-g09d2