From 12dcb01b3ef9f956d04f8a708847d160f4756e4b Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 4 Jan 2019 15:08:41 +0100 Subject: archPackagesUpdate: fix PKGBUILDpatch appliance --- archPackagesUpdate | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'archPackagesUpdate') diff --git a/archPackagesUpdate b/archPackagesUpdate index 0b277322..afefbd5e 100755 --- a/archPackagesUpdate +++ b/archPackagesUpdate @@ -547,17 +547,28 @@ if ${aufRechenknecht}; then # add PKGBUILD-patches to the PKGBUILD { - printf '%s\n' \ - 'eval "$(' \ - ' declare -f package | \' \ - ' sed '"'"'$d'"'" - for patch in "${tmp_dir}/"*".PKGBUILDpatch"; do - printf ' cat "${srcdir}/%s"\n' \ - "${patch##*/}" - done - printf '%s\n' \ - ')"' \ - 'source+=(' + if grep -q '^\s*pkgbase=' PKGBUILD; then + ( + eval "$( + sed -n '/^\s*pkgname=(/,/)/ p' PKGBUILD + )" + printf 'package_%s\n' "${pkgname[@]}" + ) + else + printf 'package\n' + fi \ + | while read -r function; do + printf '%s\n' \ + 'eval "$(' \ + ' declare -f package | \' \ + ' sed '"'"'$d'"'" + for patch in "${tmp_dir}/"*".PKGBUILDpatch"; do + printf ' cat "%s"\n' \ + "${patch##*/}" + done + printf ')\n}"\n' + done + printf 'source+=(\n' for patch in "${tmp_dir}/"*".PKGBUILDpatch"; do printf '"%s"\n' \ "${patch##*/}" @@ -576,8 +587,9 @@ if ${aufRechenknecht}; then | awk '{print $1}' printf ')\n' done - } | \ - sponge -a PKGBUILD + } > PKGBUILD.append + cat PKGBUILD.append >> PKGBUILD + rm PKGBUILD.append if [ "${arch}" = 'i686' ]; then # 32-bit is built in chroot /opt/arch32 -- cgit v1.2.3-70-g09d2