diff options
author | Erich Eckner <git@eckner.net> | 2020-05-06 22:13:08 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-05-06 22:13:08 +0200 |
commit | 49449fa6b87b97d5c30fbdd1b5266ee757d808d7 (patch) | |
tree | ac9ccdeda40271788732e1f711c288215938e591 | |
parent | 4eb4160a5f45173838a2d721a2b949697fb0b065 (diff) | |
download | archlinuxewe-49449fa6b87b97d5c30fbdd1b5266ee757d808d7.tar.xz |
archPackagesUpdate: do not patch PKGBUILD multiple times
-rwxr-xr-x | archPackagesUpdate | 69 |
1 files 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') |