HoldPkg in target list causes transaction to fail

Signed-off-by: Matthew Sexton <mssxtn@gmail.com>
This commit is contained in:
Matthew Sexton 2023-06-23 16:02:06 -04:00
parent 2c45e854ab
commit 1098ec077d

View file

@ -131,19 +131,16 @@ int pacman_remove(alpm_list_t *targets)
} }
/* Search for holdpkg in target list */ /* Search for holdpkg in target list */
int holdpkg = 0;
for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) { for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = i->data; alpm_pkg_t *pkg = i->data;
if(alpm_list_find(config->holdpkg, alpm_pkg_get_name(pkg), fnmatch_cmp)) { if(alpm_list_find(config->holdpkg, alpm_pkg_get_name(pkg), fnmatch_cmp)) {
pm_printf(ALPM_LOG_WARNING, _("%s is designated as a HoldPkg.\n"), pm_printf(ALPM_LOG_ERROR, _("%s is designated as a HoldPkg, cannot complete transaction\n"),
alpm_pkg_get_name(pkg)); alpm_pkg_get_name(pkg));
holdpkg = 1; colon_printf(_("remove %s from HoldPkg to allow removal of the held package\n"),
alpm_pkg_get_name(pkg));
return 1;
} }
} }
if(holdpkg && (noyes(_("HoldPkg was found in target list. Do you want to continue?")) == 0)) {
retval = 1;
goto cleanup;
}
/* Step 3: actually perform the removal */ /* Step 3: actually perform the removal */
alpm_list_t *pkglist = alpm_trans_get_remove(config->handle); alpm_list_t *pkglist = alpm_trans_get_remove(config->handle);