makepkg: simplify attr matching in extract_function_var
Interesting attributes created with 'local' or 'declare' won't be surfaced in .PKGINFO, so we shouldn't try to look for them. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
3f0303dc92
commit
62c11e450a
1 changed files with 3 additions and 3 deletions
|
@ -2398,14 +2398,14 @@ extract_function_var() {
|
||||||
local funcname=$1 attr=$2 isarray=$3 outputvar=$4 attr_regex= decl= r=1
|
local funcname=$1 attr=$2 isarray=$3 outputvar=$4 attr_regex= decl= r=1
|
||||||
|
|
||||||
if (( isarray )); then
|
if (( isarray )); then
|
||||||
printf -v attr_regex '^[[:space:]]*(declare( -[[:alpha:]])*)? %q\+?=\(' "$2"
|
printf -v attr_regex '^[[:space:]]* %s\+?=\(' "$2"
|
||||||
else
|
else
|
||||||
printf -v attr_regex '^[[:space:]]*(declare( -[[:alpha:]])*)? %q\+?=[^(]' "$2"
|
printf -v attr_regex '^[[:space:]]* %s\+?=[^(]' "$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read -r; do
|
while read -r; do
|
||||||
# strip leading whitespace and any usage of declare
|
# strip leading whitespace and any usage of declare
|
||||||
decl=${REPLY##*([[:space:]])?(declare +(-+([[:alpha:]]) ))}
|
decl=${REPLY##*([[:space:]])}
|
||||||
eval "${decl/#$attr/$outputvar}"
|
eval "${decl/#$attr/$outputvar}"
|
||||||
|
|
||||||
# entering this loop at all means we found a match, so notify the caller.
|
# entering this loop at all means we found a match, so notify the caller.
|
||||||
|
|
Loading…
Add table
Reference in a new issue