summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@debian.org>2017-11-06 15:03:55 +0100
committerMattia Rizzolo <mattia@debian.org>2017-11-06 15:03:55 +0100
commitaf8f129dc6ccff46919bb136ee460aa892dc660f (patch)
treee3e04d19879f08cf7e7286f4f007a793a7f35a0d
parentc45bf9c48100cb6ceb273fc474af52aa1f20721f (diff)
downloadjenkins.debian.net-af8f129dc6ccff46919bb136ee460aa892dc660f.tar.xz
udd-query: multiarch_versionskew: check the count of elements in the file instead of file size
psql now always print at least a newline, even if no records are returned, that broke our `[ -s $UDD ]` check. Read the whole file once and put it in a bash array for futher usage, including counting the elements. Closes: #864238 Signed-off-by: Mattia Rizzolo <mattia@debian.org>
-rwxr-xr-xbin/udd-query.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/udd-query.sh b/bin/udd-query.sh
index fb62c8cb..1e18558d 100755
--- a/bin/udd-query.sh
+++ b/bin/udd-query.sh
@@ -46,7 +46,8 @@ multiarch_versionskew() {
ORDER BY source ;"
udd_query
- if [ -s $UDD ] ; then
+ local PKGS=($(< "$UDD"))
+ if [ ${#PKGS[@]} -gt 0 ] ; then
if [ "$DISTRO" != "sid" ] ; then
echo "Warning: multi-arch version skew in $DISTRO detected."
else
@@ -55,9 +56,8 @@ multiarch_versionskew() {
fi
echo
printf " Package | Tracker\n"
- # bash sucks: it's printf(1) implementation doesn't like leading dashes as-is...
printf -- "--------------------------------------------------------------------------\n"
- for pkg in $(cat $UDD) ; do
+ for pkg in "${PKGS[@]}" ; do
printf "%25s | %s\n" "$pkg" "https://tracker.debian.org/$pkg"
# TODO: show versions (per arch) too
done