[namcap] parsepkgbuild.sh: fix detection of split pkgbuilds with empty pkgbase
diff mbox

Message ID 20181031093552.30483-1-michael.straube@posteo.de
State New
Headers show

Commit Message

Eli Schwartz via arch-projects Oct. 31, 2018, 9:35 a.m. UTC
For split pkgbuilds the pkgbase variable is optional. If not specified,
the first element in the pkgname array is used. Currently parsepkgbuild.sh
fails to detect split pkgbuilds if pkgbase is not specified. Therefore the
split pkgbuild rules are not applied to such pkgbuilds.

Instead of testing if pkgbase is set, test if the pkgname array has more
than one element. If so, set pkgbase accordingly.

Signed-off-by: Michael Straube <michael.straube@posteo.de>
---
 parsepkgbuild.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/parsepkgbuild.sh b/parsepkgbuild.sh
index a158d1e..d85574d 100644
--- a/parsepkgbuild.sh
+++ b/parsepkgbuild.sh
@@ -140,7 +140,8 @@  compgen -A variable
 }
 
 # is it a split pkgbuild ?
-if [ -n "${pkgbase}" ]; then
+if [ "${#pkgname[@]}" -gt 1 ]; then
+	pkgbase=${pkgbase:-${pkgname[0]}}
 	_namcap_pkgnames=(${pkgname[@]})
 	unset pkgname
 	echo -e "%SPLIT%\n1\n"