summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-04-18 01:17:04 +0200
committerHolger Levsen <holger@layer-acht.org>2015-04-18 01:19:17 +0200
commit9f01d698c5932dfdb22340fa05fac054ffbc5ea2 (patch)
tree457b8a3db6a3857301a9493cf34ba4fd1e93f3b9 /bin
parent32522d0e8803ac986354d6e3fbe0e66ad50dc2f5 (diff)
downloadjenkins.debian.net-9f01d698c5932dfdb22340fa05fac054ffbc5ea2.tar.xz
reproducible: maintenance: bash can't correctly loop over sqlite3(1) output, use a temp file
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_maintenance.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 4e1014ba..3ccdac3d 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.)