[Qa-jenkins-scm] [jenkins.debian.net] 02/04: reproducible debian: add and use query_to_print bash function

Holger Levsen holger at layer-acht.org
Tue Nov 8 15:53:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 464d96e0aea8158077777ddd42cd2cc3d6bbd01a
Author: Valerie R Young <spectranaut at riseup.net>
Date:   Fri Sep 16 19:47:35 2016 -0400

    reproducible debian: add and use query_to_print bash function
    
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_maintenance.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index e8b7918..5450395 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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list