libmakepkg: don't save/set/restore extglob in bash [[ tests

Since bash 4.1 extglobs can be used within [[ ... ]] regardless of
whether the shopt is set. Our configure.ac requires bash 4.1.0 at a
minimum for pacman scripts.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2018-05-02 15:54:36 -04:00 committed by Allan McRae
parent 542c3cf812
commit 2b4c996b86

View file

@ -42,15 +42,10 @@ is_array() {
local v=$1 local v=$1
local ret=1 local ret=1
# this function requires extglob - save current status to restore later
local shellopts=$(shopt -p extglob)
shopt -s extglob
if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
ret=0 ret=0
fi fi
eval "$shellopts"
return $ret return $ret
} }