From c40cdfde32ad440cf7c989f597449806e3a89cda Mon Sep 17 00:00:00 2001 From: merakor Date: Fri, 29 May 2020 16:54:52 +0000 Subject: kiss: simpler reverse dependency checking FossilOrigin-Name: 80d2ed109e0b7f466e5800aa595caec8ef9266c561cf3e5ea2c17931b456416f --- kiss | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/kiss b/kiss index e502437..d76b9d0 100755 --- a/kiss +++ b/kiss @@ -1036,21 +1036,13 @@ pkg_remove() { # overwritten. pkg_list "$1" >/dev/null || return - set +f - # Make sure that nothing depends on this package. - [ "$2" = check ] && for file in "$sys_db/"*; do - # Check each depends file for the package and if it's - # a run-time dependency, append to the $required_by string. - "$grep" -qFx "$1" "$file/depends" 2>/dev/null && - required_by="$required_by'${file##*/}', " - done - - [ "$required_by" ] && - die "$1" "Package is required by ${required_by%, }" - - set -f + [ "$KISS_FORCE" = 1 ] || { + log "$1" "Checking for reverse dependencies" + (cd "$sys_db"; set +f; grep -lFx "$1" -- */depends) && + die "$1" "Can't remove package, others depend on it" + } # Block being able to abort the script with 'Ctrl+C' during removal. # Removes all risk of the user aborting a package removal leaving # an incomplete package installed. -- cgit v1.2.3