From 17bafe47fec55a403e3714e60c70ce6ef322a0ec Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Wed, 19 Feb 2020 23:21:37 +0000 Subject: 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. FossilOrigin-Name: 8d852f32076ade5a1285966c06f0fe04b2a74cc463b0d07b7813fbe2bbef29c1 --- kiss | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'kiss') diff --git a/kiss b/kiss index 35dd82a..4adb987 100755 --- a/kiss +++ b/kiss @@ -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() ( -- cgit v1.2.3