kiss: cleanup

This commit is contained in:
Dylan Araps 2020-09-14 16:41:21 +03:00
parent dd39d0e015
commit dd37c86f71
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 24 additions and 12 deletions

32
kiss
View File

@ -430,35 +430,47 @@ pkg_fixdeps() {
find "$pkg_dir/${PWD##*/}/" -type f 2>/dev/null | find "$pkg_dir/${PWD##*/}/" -type f 2>/dev/null |
while read -r file; do while read -r file; do
# Run 'ldd' on the file and parse each line. The code then checks to
# see which packages own the linked libraries and it prints the result.
ldd "$file" 2>/dev/null | while read -r _ _ dep _; do ldd "$file" 2>/dev/null | while read -r _ _ dep _; do
# Resolve path symlinks to find the real location to the library. # Resolve path symlinks to find the real location to the library.
cd -P "${dep%/*}" 2>/dev/null || continue cd -P "${dep%/*}" 2>/dev/null || continue
# Skip files owned by libc and POSIX. # Skip files owned by libc and POSIX.
case ${dep##*/} in case ${dep##*/} in
"" | ld-* | libpthread.so* | lib[cm].so* | libdl.so* |\ ld-* |\
librt.so* | libtrace.so* | libxnet.so*) lib[cm].so* |\
libdl.so* |\
libpthread.so* |\
librt.so* |\
libtrace.so* |\
libxnet.so* |\
"")
continue continue
;; ;;
esac esac
# Figure out which package owns the file. # Figure out which package owns the file.
dep=$(grep -lFx "${PWD#"$KISS_ROOT"}/${dep##*/}" "$@") dep=$(grep -lFx "${PWD#"$KISS_ROOT"}/${dep##*/}" "$@")
dep=${dep%/*} dep=${dep##*/} dep=${dep%/*}
dep=${dep##*/}
case $dep in case $dep in
# Skip listing these packages as dependencies. # Skip listing these packages as dependencies.
# The pkg_name portions are to workaround incorrect detections gcc |\
# from -bin or -esr packages. llvm |\
""|gcc|llvm|"${pkg_name%%-bin}"|\ "${pkg_name%%-bin}" |\
"${pkg_name%%-esr}"|"${pkg_name%%-esr-bin}") ;; "${pkg_name%%-esr}" |\
"${pkg_name%%-esr-bin}" |\
"")
continue
;;
*) printf '%s\n' "$dep" *) printf '%s\n' "$dep"
esac esac
done ||: done ||:
done | sort -uk1,1 depends - > "$mak_dir/d" done |
sort -uk1,1 depends - > "$mak_dir/d"
# Display a 'diff' of the new dependencies against the old ones. # Display a 'diff' of the new dependencies against the old ones.
diff -U 3 depends - < "$mak_dir/d" ||: diff -U 3 depends - < "$mak_dir/d" ||: