cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 0be1ad131aa48ae0b0e0b8b5d4967abbedb68982
parent f14dc268f34d5140a8116cafe1eafc1d45421447
Author: Cem Keylan <cem@ckyln.com>
Date:   Fri, 29 May 2020 19:54:53 +0300

kiss: simpler reverse dependency checking

Diffstat:
Mkiss | 18+++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)

diff --git 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.