diff mbox

[Cbuildv2/get_source,04/17] lib/common.sh: Suppress extraneous trailing whitespace in get_URL and get_source output.

Message ID 1382129579-5777-5-git-send-email-ryan.arnold@linaro.org
State New
Headers show

Commit Message

Ryan S. Arnold Oct. 18, 2013, 8:52 p.m. UTC
From: "Ryan S. Arnold" <ryan.arnold@linaro.org>

Change uses of echo "${url} ${branch} ${revision}" in get_URL and
get_source to "${url}${branch:+ ${branch}}${revision:+ ${revision}}" in
order to suppress unnecessary spaces which makes parsing the return value
cumbersome due to potential trailing whitespace.
---
 lib/common.sh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/lib/common.sh b/lib/common.sh
index e6655a1..6fb7b7b 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -118,13 +118,10 @@  get_URL()
     if test -e ${srcs}; then
 	if test "`grep -c "^${node}" ${srcs}`" -gt 1; then
 	    error "Need unique component and version to get URL!"
-	    echo "" 1>&2
-	    echo "Choose one from this list" 1>&2
-#	    list_URL $1
 	    return 1
 	fi
 	local url="`grep "^${node}" ${srcs} | sed -e 's:^.* ::'`"
-	echo "${url} ${branch} ${revision}"
+	echo "${url}${branch:+ ${branch}}${revision:+ ${revision}}"
 
 	return 0
     else
@@ -437,7 +434,7 @@  get_source()
 	fi
     fi
 
-    echo "${url} ${branch} ${revision}"
+    echo "${url}${branch:+ ${branch}}${revision:+ ${revision}}"
 
     return 0
 }