This helpers functions allows checking for the existence of a package
variable without worrying if it is an array or not.

Signed-off-by: morganamilo <morganam...@gmail.com>
---
 scripts/libmakepkg/util/pkgbuild.sh.in | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in 
b/scripts/libmakepkg/util/pkgbuild.sh.in
index b29229a3..f9fc440b 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -98,6 +98,15 @@ extract_function_variable() {
        return $r
 }
 
+exists_function_variable() {
+       # $1: function name
+       # $2: variable name
+
+       local funcname=$1 attr=$2 out
+       extract_function_variable "$funcname" "$attr" 0 out || \
+               extract_function_variable "$funcname" "$attr" 1 out
+}
+
 get_pkgbuild_attribute() {
        # $1: package name
        # $2: attribute name
-- 
2.20.1

Reply via email to