[pacman-dev] [PATCH v5 2/4] libmakepkg: add exists_function_variable helper
morganamilo
morganamilo at gmail.com
Mon Jan 21 23:59:30 UTC 2019
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 <morganamilo at 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
More information about the pacman-dev
mailing list