diff options
author | Dave Reisner <dreisner@archlinux.org> | 2014-08-03 02:28:05 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-08-08 05:44:40 +0200 |
commit | 17ed9eb7342670a18337516312a25e6cc0b8936c (patch) | |
tree | 02411872fe885c30b2ee5b115b5d435f49894755 | |
parent | 2b556d89de0d3f10466b4db4d8915a3ffb1163de (diff) | |
download | pacman-17ed9eb7342670a18337516312a25e6cc0b8936c.tar.gz pacman-17ed9eb7342670a18337516312a25e6cc0b8936c.tar.xz |
makepkg: replace bare eval with var extraction functions
-rw-r--r-- | scripts/makepkg.sh.in | 18 |
1 files 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 |