diff options
author | Erich Eckner <git@eckner.net> | 2024-07-09 14:30:17 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2024-07-09 14:30:17 +0200 |
commit | 1ce958e91ea06e47e907c9770cc04ebb40806cb9 (patch) | |
tree | 2faa0996bbf7ea390e076eaa88aa80badcd50d57 | |
parent | ad9bcada55b59d3356e5831945392d3e154a587c (diff) | |
download | archlinuxewe-1ce958e91ea06e47e907c9770cc04ebb40806cb9.tar.xz |
extract patching to addPkgbuildPatch
-rwxr-xr-x | addPkgbuildPatch | 41 | ||||
-rwxr-xr-x | archPackagesUpdate | 38 |
2 files changed, 42 insertions, 37 deletions
diff --git a/addPkgbuildPatch b/addPkgbuildPatch new file mode 100755 index 000000000..247879398 --- /dev/null +++ b/addPkgbuildPatch @@ -0,0 +1,41 @@ +#!/bin/bash + +tmpDir=$(dirname "$(readlink -e "$0")") + +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 + 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 diff --git a/archPackagesUpdate b/archPackagesUpdate index 42316e20c..fc1596ebe 100755 --- a/archPackagesUpdate +++ b/archPackagesUpdate @@ -533,43 +533,7 @@ for ((i=0; i<${#pakete[@]}; i++)); do cd "${tmpDir}/${paket}" rm -rf --one-file-system src pkg - 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 - 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 + ../addPkgbuildPatch case "${arch}" in 'any'|'i486'|'i686'|'pentium4'|'x86_64'|"${myArch}") |