[Qa-jenkins-scm] [jenkins.debian.net] 03/03: udd-query: multiarch_versionskew: check the count of elements in the file instead of file size

Mattia Rizzolo mattia at debian.org
Mon Nov 6 14:06:31 UTC 2017


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

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

commit af8f129dc6ccff46919bb136ee460aa892dc660f
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Mon Nov 6 15:03:55 2017 +0100

    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 at debian.org>
---
 bin/udd-query.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/udd-query.sh b/bin/udd-query.sh
index fb62c8c..1e18558 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

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