From 33c83ea2daefa2a5ae9e419c74e0928476cfd198 Mon Sep 17 00:00:00 2001 From: merakor Date: Sun, 12 Apr 2020 19:39:41 +0000 Subject: kiss: fix pkg_fixdeps The fixdeps function now, * Follows links of the dependent files * Fallbacks by removing the '/usr' prefix for rare cases where a package is installed without the /usr prefix FossilOrigin-Name: 600311a79f1514ca7aa10adb86e70d004d230b73f3ff3c3394f0f74c514799d8 --- kiss | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/kiss b/kiss index a3f7428..ca7e6c7 100755 --- a/kiss +++ b/kiss @@ -408,8 +408,7 @@ pkg_fixdeps() { # Generate a list of all installed manifests. pkg_name=$1 - set +f - set -f -- "$sys_db/"*/manifest + set +f; set -f -- "$sys_db/"*/manifest # Get a list of binaries and libraries, false files # will be found, however it's faster to get 'ldd' to check @@ -424,22 +423,31 @@ pkg_fixdeps() { # Skip lines containing 'ldd'. [ "${dep##*ldd*}" ] || continue - # Extract the file path from 'ldd' output. + # Extract the file path from 'ldd' output, and + # canonicalize the path. dep=${dep#* => } dep=${dep% *} + dep=$(readlink -f "$dep") # Figure out which package owns the file. - dep=$("$grep" -lFx "${dep##$KISS_ROOT}" "$@") + own=$("$grep" -lFx "${dep##$KISS_ROOT}" "$@") + + # If the package wasn't found, retry by removing + # the '/usr' prefix. + if [ -z "$own" ] && [ -z "${dep%%/usr*}" ]; then + dep=${dep#/usr} + own=$("$grep" -lFx "${dep##$KISS_ROOT}" "$@") + fi # Extract package name from 'grep' match. - dep=${dep%/*} - dep=${dep##*/} + own=${own%/*} + own=${own##*/} - case $dep in - # Skip listing these packages as dependencies. - musl|gcc|${PWD##*/}|"") ;; - *) printf '%s\n' "$dep" ;; - esac + case $own in musl|gcc|"$pkg_name"|"") continue ; esac + printf 'Found %s (%s) in (%s)\n' "$own" "$dep" \ + "${file##$pkg_dir/$pkg_name}" >/dev/tty + + printf '%s\n' "$own" done ||: done >> depends -- cgit v1.2.3