From a888f377a5c805f1da24b556e6a4a9e3678d8eb3 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Sun, 24 Aug 2008 23:24:53 +0200 Subject: HoldPkg rework The HoldPkg feature is even more important when the packages to be held are pulled automatically by pacman, in a -Rc and -Rs operation. Before, it only applied when the packages were explicitly requested by the user to be removed. This patch extends holdpkg to -Rc and -Rs by doing the HoldPkg check just before trans_commit. Additionally, the whole HoldPkg stuff was moved to the front-end. I changed the default behavior to "don't remove", so I modified remove030.py pactest as well. See also: FS#9173. Original-work-by: Xavier Chantry Signed-off-by: Nagy Gabor Signed-off-by: Dan McGee --- src/pacman/remove.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/pacman/remove.c') diff --git a/src/pacman/remove.c b/src/pacman/remove.c index b70f7035..841a08bb 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -121,6 +121,21 @@ int pacman_remove(alpm_list_t *targets) goto cleanup; } + /* Search for holdpkg in target list */ + int holdpkg = 0; + for(i = alpm_trans_get_pkgs(); i; i = alpm_list_next(i)) { + pmpkg_t *pkg = alpm_list_getdata(i); + if(alpm_list_find_str(config->holdpkg, alpm_pkg_get_name(pkg))) { + pm_printf(PM_LOG_WARNING, _("%s is designated as a HoldPkg.\n"), + alpm_pkg_get_name(pkg)); + holdpkg = 1; + } + } + if(holdpkg && (noyes(_("HoldPkg was found in target list. Do you want to continue?")) == 0)) { + retval = 1; + goto cleanup; + } + /* Warn user in case of dangerous operation */ if(config->flags & PM_TRANS_FLAG_RECURSE || config->flags & PM_TRANS_FLAG_CASCADE) { -- cgit v1.2.3