aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-04-12 19:39:41 +0000
committermerakor <cem@ckyln.com>2020-04-12 19:39:41 +0000
commit33c83ea2daefa2a5ae9e419c74e0928476cfd198 (patch)
tree91f7f4604a5e056fa787fe619ca3afd8f66f3355
parent7286ebf4428bca8780d0e83084c47e80636514d8 (diff)
downloadcpt-33c83ea2daefa2a5ae9e419c74e0928476cfd198.tar.gz
kiss: fix pkg_fixdeps1.12.1
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
-rwxr-xr-xkiss30
1 files 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