[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible: maintenance: bash can't correctly loop over sqlite3(1) output, use a temp file

Holger Levsen holger at moszumanska.debian.org
Fri Apr 17 23:19:23 UTC 2015


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 9f01d698c5932dfdb22340fa05fac054ffbc5ea2
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Sat Apr 18 01:17:04 2015 +0200

    reproducible: maintenance: bash can't correctly loop over sqlite3(1) output, use  a temp file
---
 bin/reproducible_maintenance.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 4e1014b..3ccdac3 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -184,18 +184,19 @@ if grep -q '|' $PACKAGES ; then
 fi
 rm $PACKAGES
 
-# find packages which have been removed from unstable
+# find packages which have been removed from the archive
+PACKAGES=$(mktemp)
 QUERY="SELECT name, suite, architecture FROM removed_packages
 		LIMIT 25"
-PACKAGES=$(sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY")
-if [ ! -z "$PACKAGES" ] ; then
+sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY" > $PACKAGES 2> /dev/null || echo "Warning: SQL query '$QUERY' failed."
+if grep -q '|' $PACKAGES ; then
 	DIRTY=true
 	echo
 	echo "Warning: found files relative to old packages, no more in the archive:"
 	echo "Removing these removed packages from database:"
-	echo $PACKAGES
+	cat $PACKAGES
 	echo
-	for pkg in "$PACKAGES" ; do
+	for pkg in $(cat $PACKAGES) ; do
 		PKGNAME=$(echo "$pkg" | cut -d '|' -f 1)
 		SUITE=$(echo "$pkg" | cut -d '|' -f 2)
 		ARCH=$(echo "$pkg" | cut -d '|' -f 3)
@@ -207,6 +208,7 @@ if [ ! -z "$PACKAGES" ] ; then
 	done
 	cd -
 fi
+rm $PACKAGES
 
 # delete jenkins html logs from reproducible_builder_* jobs as they are mostly redundant
 # (they only provide the extended value of parsed console output, which we dont need here.)

-- 
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