kiss: cleanup fixdeps

This commit is contained in:
Dylan Araps 2020-09-14 20:32:42 +03:00
parent dd37c86f71
commit 6f426a1149
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 8 additions and 18 deletions

26
kiss
View File

@ -412,25 +412,19 @@ pkg_fixdeps() {
pkg_name=$1
# Go to the built package directory to simplify path building.
cd "$pkg_dir/$1/$pkg_db/$1"
# Generate a list of all installed manifests.
set +f
set -f -- "$sys_db/"*/manifest
# Create the depends file if it doesn't exist to have something to
# compare against (even if empty). We will remove this blank file
# later if needed.
: >> depends
# Get a list of binaries and libraries, false files will be found,
# however it's faster to get 'ldd' to check them anyway than to filter
# them out.
find "$pkg_dir/${PWD##*/}/" -type f 2>/dev/null |
while read -r file; do
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.
cd -P "${dep%/*}" 2>/dev/null || continue
@ -453,34 +447,30 @@ pkg_fixdeps() {
dep=${dep%/*}
dep=${dep##*/}
# Skip listing some packages as dependencies.
case $dep in
# Skip listing these packages as dependencies.
gcc |\
llvm |\
"${pkg_name%%-bin}" |\
"${pkg_name%%-esr}" |\
"${pkg_name%%-esr-bin}" |\
"")
continue
continue
;;
*) printf '%s\n' "$dep"
*)
printf '%s\n' "$dep"
;;
esac
done ||:
done |
sort -uk1,1 depends - > "$mak_dir/d"
# Display a 'diff' of the new dependencies against the old ones.
diff -U 3 depends - < "$mak_dir/d" ||:
# Swap out the old depends file for the new one which contains
# an amended dependency list.
mv -f "$mak_dir/d" depends
# Remove the package's depends file if it's empty. (The package has
# no dependencies, automatically detected or otherwise).
[ -s depends ] || rm -f depends
}