diff options
author | Erich Eckner <git@eckner.net> | 2020-05-06 10:27:34 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-05-06 10:27:34 +0200 |
commit | e25fa8a44c98b460a4a0cce52741dfe63ffc969c (patch) | |
tree | 0c20e06d1bdbb4b569bfc091ad696470ff483147 /pin-dependencies.PKGBUILDpatch | |
parent | 69e1649a6898d040393102a9080f17365ff1b59b (diff) | |
download | archlinuxewe-e25fa8a44c98b460a4a0cce52741dfe63ffc969c.tar.xz |
pin-dependencies.PKGBUILDpatch: automatically add libraries, which are provided by the dependency, as the library dependency instead of the package dependency
Diffstat (limited to 'pin-dependencies.PKGBUILDpatch')
-rw-r--r-- | pin-dependencies.PKGBUILDpatch | 81 |
1 files changed, 51 insertions, 30 deletions
diff --git a/pin-dependencies.PKGBUILDpatch b/pin-dependencies.PKGBUILDpatch index 09e1be04a..cc0fbd5ae 100644 --- a/pin-dependencies.PKGBUILDpatch +++ b/pin-dependencies.PKGBUILDpatch @@ -5,43 +5,64 @@ if printf '%s\n' "${arch[@]}" | grep -qvxF any; then 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 ' - s/^\s*NEEDED\s\+\(\S\+\)\s*$/\1/ + :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 ' \ - | sort -u - printf '%s\n' "${depends[@]}" \ | sed ' - s/[<>=].*$// - /\.so$/ !d - p + s/^glibc=/glibc>=/ ' - } \ - | sort \ - | uniq -u \ - | while read -r _lib; do - pacman -Qqo "/usr/lib/${_lib}" 2>/dev/null || true - done \ - | sort -u \ - | xargs -r pacman -Q \ - | sed ' - s/ \([^-]\+\)-[^-]\+$/=\1/ - t - w /dev/stderr - d - ' \ - | sed ' - s/^glibc=/glibc>=/ - ' + fi + done \ + | sort -u } \ - | sed ' - s/^\([^<>=[:space:]]\+\)\([<>]\?=\(\S\+\)\)\?$/\0 \1 \3/ - ' \ - | sort -k2,2 -k3Vr,3 \ - | cut -d' ' -f1,2 \ - | uniq -f1 \ - | cut -d' ' -f1 + | sed ' + s/^\([^<>=[:space:]]\+\)\([<>]\?=\(\S\+\)\)\?$/\0 \1 \3/ + ' \ + | sort -k2,2 -k3Vr,3 \ + | cut -d' ' -f1,2 \ + | uniq -f1 \ + | cut -d' ' -f1 ) ) fi |