kiss: simplify depends finder file handling.

Removes the use of multiple temporary files and the
number of times they're shuffled around. POSIX sort
is neat.

This should bring minor speedups to the dependency
finder on top of installing GNU grep. I'm sure this
can be further simplified.

I'll be tackling the reduction of checked files
next. Wish me luck.
This commit is contained in:
Dylan Araps 2020-02-20 01:21:37 +02:00
parent ad89d327f9
commit c19dd3b75d
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 5 additions and 9 deletions

14
kiss
View File

@ -389,7 +389,7 @@ pkg_fixdeps() {
# Make a copy of the depends file if it exists to have a
# reference to 'diff' against.
[ -f depends ] && cp -f depends depends-copy
[ -f depends ] && cp -f depends "$mak_dir/d"
# Generate a list of all installed manifests.
pkg_name=$1
@ -426,20 +426,16 @@ pkg_fixdeps() {
*) printf '%s\n' "$dep" ;;
esac
done ||:
done >> depends-copy
done |
# Remove duplicate entries from the new depends file.
# This remove duplicate lines looking *only* at the
# first column.
sort -u -k1,1 depends-copy > depends-new
sort -uk1,1 -o depends depends -
# Display a 'diff' of the new dependencies agaisnt
# Display a 'diff' of the new dependencies against
# the old ones. '-N' treats non-existent files as blank.
diff -N depends depends-new ||:
# Do some clean up as this required a few temporary files.
mv -f depends-new depends
rm -f depends-copy
diff -N "$mak_dir/d" depends ||:
}
pkg_manifest() (