kiss: Fix fixdeps() bugs. Closes #132

This commit is contained in:
Dylan Araps 2020-04-15 11:58:01 +03:00
parent acb9398f62
commit f9c0533280
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

32
kiss
View File

@ -390,9 +390,14 @@ pkg_fixdeps() {
# Generate a list of all installed manifests. # Generate a list of all installed manifests.
set +f; set -f -- "$sys_db/"*/manifest set +f; set -f -- "$sys_db/"*/manifest
# Cat the current depends file if it exists as we will append # Make a copy of the depends file if it exists to have a
# detected dependencies to it. # reference to 'diff' against.
{ cat depends 2>/dev/null ||: if [ -f depends ]; then
cp -f depends "$mak_dir/d"
dep_file=$mak_dir/d
else
dep_file=/dev/null
fi
# Get a list of binaries and libraries, false files # Get a list of binaries and libraries, false files
# will be found, however it's faster to get 'ldd' to check # will be found, however it's faster to get 'ldd' to check
@ -418,19 +423,20 @@ pkg_fixdeps() {
own=${own##*/} own=${own##*/}
# Skip listing these packages as dependencies. # Skip listing these packages as dependencies.
case $own in musl|gcc|${PWD##*/}|"") continue; esac case $own in musl|gcc|"${PWD##*/}"|"") continue; esac
printf 'Found %s (%s) in (%s)\n' "$own" "$dep" \
"${file##$pkg_dir/${PWD##*/}}" >/dev/tty
printf '%s\n' "$own" printf '%s\n' "$own"
done ||: done ||:
done } | done >> depends
# Sort the list and remove duplicates. Generate a diff between the # Remove duplicate entries from the new depends file.
# original dependencies and the new dependencies. Finally, apply the # This removes duplicate lines looking *only* at the
# patch directly to the depends file. # first column.
sort -uk1,1 | diff - depends 2>/dev/null | patch -Rp1 ||: sort -uk1,1 -o depends depends 2>/dev/null ||:
# Display a 'diff' of the new dependencies against
# the old ones. '-N' treats non-existent files as blank.
diff "$dep_file" depends ||:
} }
pkg_manifest() ( pkg_manifest() (
@ -1194,7 +1200,7 @@ args() {
esac esac
# Second early check to use $PWD in place of arguments. # Second early check to use $PWD in place of arguments.
case $action in b|build|c|checksum|i|install|r|remove) [ "$1" ] || case $action in b|build|c|checksum|i|install|r|remove)
export KISS_PATH=${PWD%/*}:$KISS_PATH export KISS_PATH=${PWD%/*}:$KISS_PATH
set -- "${PWD##*/}" set -- "${PWD##*/}"
esac esac