[pacman-dev] [PATCH 3/3] makepkg: simplify attr matching in extract_function_var

Dave Reisner dreisner at archlinux.org
Sun Oct 12 15:38:37 UTC 2014


Interesting attributes created with 'local' or 'declare' won't be
surfaced in .PKGINFO, so we shouldn't try to look for them.
---
This mirrors upstream commit:

https://github.com/falconindy/pkgbuild-introspection/commit/def0dff

 scripts/makepkg.sh.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 9082206..4a3ae2e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2398,14 +2398,14 @@ extract_function_var() {
 	local funcname=$1 attr=$2 isarray=$3 outputvar=$4 attr_regex= decl= r=1
 
 	if (( isarray )); then
-		printf -v attr_regex '^[[:space:]]*(declare( -[[:alpha:]])*)? %q\+?=\(' "$2"
+		printf -v attr_regex '^[[:space:]]* %s\+?=\(' "$2"
 	else
-		printf -v attr_regex '^[[:space:]]*(declare( -[[:alpha:]])*)? %q\+?=[^(]' "$2"
+		printf -v attr_regex '^[[:space:]]* %s\+?=[^(]' "$2"
 	fi
 
 	while read -r; do
 		# strip leading whitespace and any usage of declare
-		decl=${REPLY##*([[:space:]])?(declare +(-+([[:alpha:]]) ))}
+		decl=${REPLY##*([[:space:]])}
 		eval "${decl/#$attr/$outputvar}"
 
 		# entering this loop at all means we found a match, so notify the caller.
-- 
2.1.2


More information about the pacman-dev mailing list