temp: commiting my latest changes

This commit is contained in:
jg 2025-07-12 12:43:52 +02:00
parent f0d717c941
commit d7e6a18d71

View file

@ -164,10 +164,10 @@ static void remove_prepare_keep_needed(alpm_handle_t *handle, alpm_list_t *lp)
* *
* @return false when no optdepends of other packages are going to be removed, true in case it will remove optdepends of other packages * @return false when no optdepends of other packages are going to be removed, true in case it will remove optdepends of other packages
*/ */
static bool remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *lp) static alpm_list_t remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *lp)
{ {
bool deleting_optdepends = false;
alpm_list_t *i; alpm_list_t *i;
alpm_list_t *result = NULL;
for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = alpm_list_next(i)) { for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = i->data; alpm_pkg_t *pkg = i->data;
@ -184,7 +184,7 @@ static bool remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *
.pkg = pkg, .pkg = pkg,
.optdep = optdep .optdep = optdep
}; };
deleting_optdepends = true; alpm_list_add(result, j->data);
EVENT(handle, &event); EVENT(handle, &event);
} }
free(optstring); free(optstring);
@ -192,7 +192,7 @@ static bool remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *
} }
} }
return deleting_optdepends; return *result;
} }
/** /**
@ -213,7 +213,7 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
alpm_trans_t *trans = handle->trans; alpm_trans_t *trans = handle->trans;
alpm_db_t *db = handle->db_local; alpm_db_t *db = handle->db_local;
alpm_event_t event; alpm_event_t event;
bool removing_optdepends; alpm_list_t optdep_to_keep;
if((trans->flags & ALPM_TRANS_FLAG_RECURSE) if((trans->flags & ALPM_TRANS_FLAG_RECURSE)
&& !(trans->flags & ALPM_TRANS_FLAG_CASCADE)) { && !(trans->flags & ALPM_TRANS_FLAG_CASCADE)) {
@ -264,14 +264,12 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
} }
/* Note packages being removed that are optdepends for installed packages */ /* Note packages being removed that are optdepends for installed packages */
if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) { if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)
removing_optdepends = remove_notify_needed_optdepends(handle, trans->remove);
}
if ((trans->flags & ALPM_TRANS_FLAG_RECURSE)
&& !(trans->flags & ALPM_TRANS_FLAG_RECURSEALL) && !(trans->flags & ALPM_TRANS_FLAG_RECURSEALL)
&& removing_optdepends) { && (trans->flags & ALPM_TRANS_FLAG_RECURSE)) {
RET_ERR(handle, ALPM_ERR_REMOVING_OPTDEPENDS_DEPS, -1); optdep_to_keep = remove_notify_needed_optdepends(handle, trans->remove);
alpm_list_remove_item(trans->remove, &optdep_to_keep);
alpm_list_free(&optdep_to_keep);
} }
if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) { if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {