diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-02-19 23:21:37 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-02-19 23:21:37 +0000 |
commit | 17bafe47fec55a403e3714e60c70ce6ef322a0ec (patch) | |
tree | f08ba1f960f36737e2775c3692a6cfb499df9f57 | |
parent | 8dcfebc0c19081e6ab0dd925da131113833c05f7 (diff) | |
download | cpt-17bafe47fec55a403e3714e60c70ce6ef322a0ec.tar.gz |
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
-rwxr-xr-x | kiss | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -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() ( |