feat: removed keepoptdep references, changed logic to take into account RECURSEALL instead

This commit is contained in:
jg 2025-02-09 20:28:36 +01:00
parent 2adbb6e4de
commit 09f1e13659
4 changed files with 3 additions and 18 deletions

View file

@ -2818,8 +2818,7 @@ typedef enum _alpm_transflag_t {
ALPM_TRANS_FLAG_NOSCRIPTLET = (1 << 10),
/** Ignore dependency conflicts. */
ALPM_TRANS_FLAG_NOCONFLICTS = (1 << 11),
/** Cancel removal of package if it's optdepends of another package. */
ALPM_TRANS_FLAG_KEEPOPTIONALS = (1 << 12),
/* (1 << 12) flag can go here */
/** Do not install a package if it is already installed and up to date. */
ALPM_TRANS_FLAG_NEEDED = (1 << 13),
/** Use ALPM_PKG_REASON_EXPLICIT when installing packages. */

View file

@ -268,18 +268,12 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
removing_optdepends = remove_notify_needed_optdepends(handle, trans->remove);
}
/* -Rks or Rsk == -Rs then -Rk */
if (trans->flags & ALPM_TRANS_FLAG_RECURSE
&& trans->flags & ALPM_TRANS_FLAG_KEEPOPTIONALS
if ((trans->flags & ALPM_TRANS_FLAG_RECURSE)
&& !(trans->flags & ALPM_TRANS_FLAG_RECURSEALL)
&& removing_optdepends) {
RET_ERR(handle, ALPM_ERR_REMOVING_OPTDEPENDS_DEPS, -1);
}
if (!(trans->flags & ALPM_TRANS_FLAG_RECURSE)
&& trans->flags & ALPM_TRANS_FLAG_KEEPOPTIONALS) {
_alpm_log(handle, ALPM_LOG_WARNING, _("-k is set without -s or --recursive, ignoring flag...\n"));
}
if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {
event.type = ALPM_EVENT_CHECKDEPS_DONE;
EVENT(handle, &event);

View file

@ -209,7 +209,6 @@ enum {
OP_UPGRADES,
OP_SYSUPGRADE,
OP_UNNEEDED,
OP_KEEPOPTDEP,
OP_VERBOSE,
OP_DOWNLOADONLY,
OP_REFRESH,

View file

@ -126,8 +126,6 @@ static void usage(int op, const char * const myname)
addlist(_(" -n, --nosave remove configuration files\n"));
addlist(_(" -s, --recursive remove unnecessary dependencies\n"
" (-ss includes explicitly installed dependencies)\n"));
addlist(_(" -k, --keepoptdep keep the packages flagged as optdepends by other packages\n"
" (only applied when using -s or --recursive)\n"));
addlist(_(" -u, --unneeded remove unneeded packages\n"));
} else if(op == PM_OP_UPGRADE) {
printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
@ -731,10 +729,6 @@ static int parsearg_remove(int opt)
case 'u':
config->flags |= ALPM_TRANS_FLAG_UNNEEDED;
break;
case OP_KEEPOPTDEP:
case 'k':
config->flags |= ALPM_TRANS_FLAG_KEEPOPTIONALS;
break;
default:
return 1;
}
@ -960,7 +954,6 @@ static int parseargs(int argc, char *argv[])
{"upgrades", no_argument, 0, OP_UPGRADES},
{"sysupgrade", no_argument, 0, OP_SYSUPGRADE},
{"unneeded", no_argument, 0, OP_UNNEEDED},
{"keepoptdep", no_argument, 0, OP_KEEPOPTDEP},
{"verbose", no_argument, 0, OP_VERBOSE},
{"downloadonly", no_argument, 0, OP_DOWNLOADONLY},
{"refresh", no_argument, 0, OP_REFRESH},