[pacman-dev,2/4] util/pkgbuild: manually set extglob

Message ID 20170225172118.5780-3-andrew.gregory.8@gmail.com
State Superseded, archived
Headers show
Series makepkg test suite | expand

Commit Message

Andrew Gregory Feb. 25, 2017, 5:21 p.m. UTC
extract_function_variable requires extglob; set it in case the caller
hasn't.
---
 scripts/libmakepkg/util/pkgbuild.sh.in | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
index 08b35f53..7074c8c5 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -74,6 +74,9 @@  extract_function_variable() {
 
 	local funcname=$1 attr=$2 isarray=$3 outputvar=$4 attr_regex= decl= r=1
 
+	local reset_shopt="$(shopt -p extglob)"
+	shopt -s extglob
+
 	if (( isarray )); then
 		printf -v attr_regex '^[[:space:]]* %s\+?=\(' "$2"
 	else
@@ -89,6 +92,8 @@  extract_function_variable() {
 		r=0
 	done < <(grep_function "$funcname" "$attr_regex")
 
+	eval "$reset_shopt"
+
 	return $r
 }