diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index d535f550..96e5e643 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -307,8 +307,6 @@ typedef enum _alpm_errno_t { ALPM_ERR_CONFLICTING_DEPS, /** Files conflict */ ALPM_ERR_FILE_CONFLICTS, - /** Removing optdepends of another dependency*/ - ALPM_ERR_REMOVING_OPTDEPENDS_DEPS, /* Misc */ /** Download failed */ ALPM_ERR_RETRIEVE, diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 1177f8b6..4a3ba648 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -161,13 +161,10 @@ static void remove_prepare_keep_needed(alpm_handle_t *handle, alpm_list_t *lp) * * @param handle the context handle * @param lp list of packages to be removed - * - * @return false when no optdepends of other packages are going to be removed, true in case it will remove optdepends of other packages */ -static alpm_list_t remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *lp) +static void remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *lp) { alpm_list_t *i; - alpm_list_t *result = NULL; for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = alpm_list_next(i)) { alpm_pkg_t *pkg = i->data; @@ -184,15 +181,12 @@ static alpm_list_t remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_l .pkg = pkg, .optdep = optdep }; - alpm_list_add(result, j->data); EVENT(handle, &event); } free(optstring); } } } - - return *result; } /** @@ -213,7 +207,6 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data) alpm_trans_t *trans = handle->trans; alpm_db_t *db = handle->db_local; alpm_event_t event; - alpm_list_t optdep_to_keep; if((trans->flags & ALPM_TRANS_FLAG_RECURSE) && !(trans->flags & ALPM_TRANS_FLAG_CASCADE)) { @@ -264,12 +257,8 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data) } /* Note packages being removed that are optdepends for installed packages */ - if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS) - && !(trans->flags & ALPM_TRANS_FLAG_RECURSEALL) - && (trans->flags & ALPM_TRANS_FLAG_RECURSE)) { - 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)) { + remove_notify_needed_optdepends(handle, trans->remove); } if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {