Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/libmakepkg
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2018-03-19 23:05:21 -0400
committerAllan McRae <allan@archlinux.org>2018-04-29 21:34:43 +1000
commitbcaf1b84ff0f0709d35cd0adb1f13965d1101aeb (patch)
tree0f8b46ac04c179d334ef20e12a7e1b8c18cf1ee6 /scripts/libmakepkg
parent27f64e378958204314a17b5c5416bd40f47603ac (diff)
libmakepkg/util/pkgbuild.sh: fix missing extglob
We use an extended glob here, but were relying on having it globally set in makepkg. This causes it to fail when used in scripts. Since scripts using libmakepkg may not want extglob to be set, save and restore the environment while explicitly setting extglob only where we need it. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg')
-rw-r--r--scripts/libmakepkg/util/pkgbuild.sh.in6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
index 25ad03ce..d35c064b 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -80,6 +80,10 @@ extract_function_variable() {
printf -v attr_regex '^[[:space:]]* %s\+?=[^(]' "$2"
fi
+ # save our shell options and turn on extglob
+ local shellopts=$(shopt -p)
+ shopt -s extglob
+
while read -r; do
# strip leading whitespace and any usage of declare
decl=${REPLY##*([[:space:]])}
@@ -89,6 +93,8 @@ extract_function_variable() {
r=0
done < <(grep_function "$funcname" "$attr_regex")
+ eval "$shellopts"
+
return $r
}