From 17ed9eb7342670a18337516312a25e6cc0b8936c Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 2 Aug 2014 20:28:05 -0400 Subject: makepkg: replace bare eval with var extraction functions --- scripts/makepkg.sh.in | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index b40c38dd..8e8a64ca 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -866,7 +866,7 @@ get_pkg_arch() { fi else local arch_override - eval $(declare -f package_$1 | sed -n 's/\(^[[:space:]]*arch=\)/arch_override=/p') + pkgbuild_get_attribute "$1" arch arch_override 0 (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}") if [[ $arch_override = "any" ]]; then printf "%s\n" "any" @@ -2121,15 +2121,21 @@ create_srcpackage() { local i for i in 'changelog' 'install'; do - local file - while read -r file; do - # evaluate any bash variables used - eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" + local file files + + [[ $install ]] && files+=("$install") + for name in "${pkgname[@]}"; do + if extract_function_var "package_$name" "$i" 0 file; then + files+=("$file") + fi + done + + for file in "${files[@]}"; do if [[ $file && ! -f "${srclinks}/${pkgbase}/$file" ]]; then msg2 "$(gettext "Adding %s file (%s)...")" "$i" "${file}" ln -s "${startdir}/$file" "${srclinks}/${pkgbase}/" fi - done < <(sed -n "s/^[[:space:]]*$i=//p" "$BUILDFILE") + done done local TAR_OPT -- cgit v1.2.3-24-g4f1b