From 3d0166966e4949af09064aa880e5bb860ed0fabe Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 4 Jun 2020 10:57:34 +0200 Subject: pin-dependencies.PKGBUILDpatch: use _pinned_dependencies instead of auto-generating depends=() --- pin-dependencies.PKGBUILDpatch | 137 ++++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 62 deletions(-) (limited to 'pin-dependencies.PKGBUILDpatch') diff --git a/pin-dependencies.PKGBUILDpatch b/pin-dependencies.PKGBUILDpatch index cc0fbd5ae..d05e54436 100644 --- a/pin-dependencies.PKGBUILDpatch +++ b/pin-dependencies.PKGBUILDpatch @@ -1,68 +1,81 @@ if printf '%s\n' "${arch[@]}" | grep -qvxF any; then - depends=( - $( - { - printf '%s\n' "${depends[@]}" - { - find "${pkgdir}" -type f -exec objdump -x {} \; 2>/dev/null \ - | sed ' - s/^\s*NEEDED\s\+\(\S\+\)\s*$/\1/ - t - d - ' \ - | sort -u - } \ - | sort \ - | uniq -u \ - | while read -r _lib; do - _pkg=$( - pacman -Qqo "/usr/lib/${_lib}" 2>/dev/null - ) || continue - if pacman -Qi "${_pkg}" \ - | sed ' - :a - $! N - s/\n\s\+/ / - ta - P - D - ' \ - | sed -n ' - s/^Provides\s*:\s*// - T - y/ /\n/ - p - ' \ - | sed -n ' - /^$/d - s/=.*$// - T - /\.so$/p - ' \ - | grep -qxF "${_lib}"; then - printf '%s\n' "${_lib}" - else - pacman -Q "${_pkg}" \ - | sed ' - s/ \([^-]\+\)-[^-]\+$/=\1/ - t - w /dev/stderr - d - ' \ - | sed ' - s/^glibc=/glibc>=/ - ' - fi - done \ - | sort -u - } \ + if ! _errors=$( + diff <( + find "${pkgdir}" -type f -exec objdump -x {} \; 2>/dev/null \ | sed ' - s/^\([^<>=[:space:]]\+\)\([<>]\?=\(\S\+\)\)\?$/\0 \1 \3/ + s/^\s*NEEDED\s\+\(\S\+\)\s*$/\1/ + t + d ' \ - | sort -k2,2 -k3Vr,3 \ - | cut -d' ' -f1,2 \ - | uniq -f1 \ - | cut -d' ' -f1 + | sort -u \ + | while read -r _lib; do + if ! _pkg=$( + pacman -Qqo "/usr/lib/${_lib}" 2>/dev/null + ); then + printf '%s\n' "${_lib}" + continue + fi + if pacman -Qi "${_pkg}" \ + | sed ' + :a + $! N + s/\n\s\+/ / + ta + P + D + ' \ + | sed -n ' + s/^Provides\s*:\s*// + T + y/ /\n/ + p + ' \ + | sed -n ' + /^$/d + s/=.*$// + T + /\.so$/p + ' \ + | grep -qxF "${_lib}"; then + printf '%s\n' "${_lib}" + else + printf '%s\n' "${_pkg}" + fi + done \ + | sed 's/[<>]\?=.*$//' \ + | sort -u + ) <( + printf '%s\n' "${_pinned_dependencies[@]}" \ + | sed 's/=.*$//' \ + | sort -u + ) + ); then + printf 'There are discrepancies between the _pinned_dependencies and the linked libraries in %s'"'"'s %s:\n' \ + "${pkgbase:-${pkgname}}" \ + "${FUNCNAME[0]}" + printf '%s\n' "${_errors}" \ + | sed ' + s/^/claimed / + t + d + ' \ + | sort -k1,1 + return 1 + fi + depends+=( + $( + printf '%s\n' "${_pinned_dependencies[@]}" \ + | if [ "${CARCH}" != 'x86_64' ]; then + sed ' + /\.so=/ { + s/-64$/-32/ + } + ' + else + cat + fi ) ) fi -- cgit v1.2.3-70-g09d2