From 49449fa6b87b97d5c30fbdd1b5266ee757d808d7 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 6 May 2020 22:13:08 +0200 Subject: archPackagesUpdate: do not patch PKGBUILD multiple times --- archPackagesUpdate | 69 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/archPackagesUpdate b/archPackagesUpdate index f057d6a7b..e2293a613 100755 --- a/archPackagesUpdate +++ b/archPackagesUpdate @@ -476,40 +476,43 @@ if ${aufRechenknecht}; then cd "${tmpDir}/${paket}" rm -rf --one-file-system src pkg - # add PKGBUILD-patches to the PKGBUILD - if grep -q '^\s*pkgbase=' PKGBUILD; then - ( - eval "$( - sed -n '/^\s*pkgname=(/,/)/ p' PKGBUILD - )" - printf 'package_%s\n' "${pkgname[@]}" - ) - else - printf 'package\n' - fi \ - | sponge \ - | while read -r function; do - sed -i ' - /^'"${function}"'() {$/,/^}$/ { - /^}$/ i _patch_PKGBUILD - } - ' PKGBUILD - done - { - echo '_patch_PKGBUILD() {' - ls -1 "${tmpDir}/"*".PKGBUILDpatch" \ - | grep -vxF "$( - sed ' - s,^# skip \(\S\+\)\(\s\|$\).*$,'"${tmpDir}"'/\1.PKGBUILDpatch, - t - d + if ! grep -qwF _patch_PKGBUILD PKGBUILD; then + + # add PKGBUILD-patches to the PKGBUILD + if grep -q '^\s*pkgbase=' PKGBUILD; then + ( + eval "$( + sed -n '/^\s*pkgname=(/,/)/ p' PKGBUILD + )" + printf 'package_%s\n' "${pkgname[@]}" + ) + else + printf 'package\n' + fi \ + | sponge \ + | while read -r function; do + sed -i ' + /^'"${function}"'() {$/,/^}$/ { + /^}$/ i _patch_PKGBUILD + } ' PKGBUILD - )" \ - | xargs -r cat - echo ':' - echo '}' - } \ - >> PKGBUILD + done + { + echo '_patch_PKGBUILD() {' + ls -1 "${tmpDir}/"*".PKGBUILDpatch" \ + | grep -vxF "$( + sed ' + s,^# skip \(\S\+\)\(\s\|$\).*$,'"${tmpDir}"'/\1.PKGBUILDpatch, + t + d + ' PKGBUILD + )" \ + | xargs -r cat + echo ':' + echo '}' + } \ + >> PKGBUILD + fi case "${arch}" in 'any'|'i486'|'i686'|'pentium4'|'x86_64') -- cgit v1.2.3-70-g09d2