[pacman-dev] [PATCH 2/7] libmakepkg: stop printsrcinfo generating empty values

morganamilo morganamilo at gmail.com
Fri Jun 8 18:18:54 UTC 2018


When a split package overriddes an array using += and the array does not
exist globally, makepkg --printsrcinfo will print the field with an
empty vlaue before printing the acual values.

For exampple: having `depends+=(foo bar)` will generate:
	depends =
	depends = foo
	depends = bar

Explicity check for empty array values and only print the values that
are not empty.

Signed-off-by: morganamilo <morganamilo at gmail.com>
---
 scripts/libmakepkg/srcinfo.sh.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/libmakepkg/srcinfo.sh.in b/scripts/libmakepkg/srcinfo.sh.in
index 509c4860..6a49be37 100644
--- a/scripts/libmakepkg/srcinfo.sh.in
+++ b/scripts/libmakepkg/srcinfo.sh.in
@@ -44,7 +44,11 @@ srcinfo_write_attr() {
 	attrvalues=("${attrvalues[@]#[[:space:]]}")
 	attrvalues=("${attrvalues[@]%[[:space:]]}")
 
-	printf "\t$attrname = %s\n" "${attrvalues[@]}"
+	for val in "${attrvalues[@]}"; do
+		if [[ ! -z ${val// /} ]]; then
+			printf "\t$attrname = %s\n" "$val"
+		fi
+	done
 }
 
 pkgbuild_extract_to_srcinfo() {
-- 
2.17.1


More information about the pacman-dev mailing list