From 466706f7c5d7d9c29d70cd5299efa4770a41f990 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 24 Sep 2020 09:16:31 +0300 Subject: [PATCH] kiss-orphans: Performance fixes. More to come --- contrib/kiss-orphans | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/contrib/kiss-orphans b/contrib/kiss-orphans index 4212c08..dbdd87d 100755 --- a/contrib/kiss-orphans +++ b/contrib/kiss-orphans @@ -1,17 +1,15 @@ #!/bin/sh -e # List orphaned packages -cd "$KISS_ROOT/var/db/kiss/installed/" -set -- * +cd "$KISS_ROOT/var/db/kiss/installed" -for pkg in *; do - case $pkg in - # Exemptions for orphans which aren't really - # orphans. Exclude them from the list. - baseinit|baselayout|gcc|e2fsprogs|musl|\ - make|busybox|bzip2|grub|kiss|git) - continue - esac +# List of installed packages. +printf -- '%s\n' * > "${TMPDIR:-/tmp}/packages" - grep -q "^$pkg$" ./*/depends || printf '%s\n' "$pkg" -done +# List of runtime dependencies. +grep -hv ' make\|^#' ./*/depends | sort -u | + +# Remove items in list 2 from list 1. +comm -23 "${TMPDIR:-/tmp}/packages" - + +rm -f "${TMPDIR:-/tmp}/packages"