summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-03-06 09:35:57 +0100
committerErich Eckner <git@eckner.net>2019-03-06 09:35:57 +0100
commit4b847c9099076c38ae6e87677a74f6644f07c63d (patch)
tree41312b48cc575d7c1f5fa8ef850a630befb53757
parent8e710fba7e2b641ef7b05a004da6ff8e52cfa475 (diff)
downloadarchlinuxewe.git.save-4b847c9099076c38ae6e87677a74f6644f07c63d.tar.xz
archPackagesUpdate: patch PKGBUILD directly instead of invoking eval inside package()
-rwxr-xr-xarchPackagesUpdate71
1 files changed, 23 insertions, 48 deletions
diff --git a/archPackagesUpdate b/archPackagesUpdate
index b1c91ba8..706a4105 100755
--- a/archPackagesUpdate
+++ b/archPackagesUpdate
@@ -546,55 +546,30 @@ if ${aufRechenknecht}; then
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 \
- | while read -r function; do
- printf '%s\n' \
- 'eval "$(' \
- ' declare -f '"${function}"' | \' \
- ' sed '"'"'$d'"'"
- for patch in "${tmpDir}/"*".PKGBUILDpatch"; do
- patch_name="${patch##*/}"
- patch_name="${patch_name%.*}"
- if grep -qF "skip ${patch_name}" PKGBUILD; then
- continue
- fi
- printf ' cat "%s"\n' \
- "${patch##*/}"
- done
- printf ')\n}"\n'
- done
- printf 'source+=(\n'
- for patch in "${tmpDir}/"*".PKGBUILDpatch"; do
- printf '"%s"\n' \
- "${patch##*/}"
- cp "${patch}" .
+ 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}"'() {$/,/^}$/ {
+ /^}$/ {'"$(
+ ls -1 "${tmpDir}/"*".PKGBUILDpatch" | \
+ sed 's/^/r /'
+ )"'
+ a }
+ d
+ }
+ }
+ ' PKGBUILD
done
- printf ')\n'
- sed '
- s/^\s*\([^=[:space:]]\+sums\)=.*$/\1/
- t
- d
- ' PKGBUILD \
- | while read -r sum_type; do
- printf '%s+=(' \
- "${sum_type}"
- "${sum_type%s}" "${tmpDir}/"*".PKGBUILDpatch" \
- | awk '{print $1}'
- printf ')\n'
- done
- } > PKGBUILD.append
- cat PKGBUILD.append >> PKGBUILD
- rm PKGBUILD.append
if [ "${arch}" = 'i686' ]; then
# 32-bit is built in chroot /opt/arch32