cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 9731e06fee8e05d886f9a0e5e660a02e838f99ba
parent 9358fb337b5f4177e31d5107d2236e049a3552d8
Author: Cem Keylan <cem@ckyln.com>
Date:   Sun, 12 Apr 2020 22:39:42 +0300

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

Diffstat:
Mkiss | 30+++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)

diff --git 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