Checking install status and if a package is optionally required on removal
now considers the version of the optdepend.

Fixes FS#44957.

Signed-off-by: Allan McRae <[email protected]>
---
 lib/libalpm/remove.c | 3 ++-
 src/pacman/util.c    | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 22211d9..45f7c2f 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -180,7 +180,8 @@ static void remove_notify_needed_optdepends(alpm_handle_t 
*handle, alpm_list_t *
                        alpm_list_t *j;
                        for(j = optdeps; j; j = alpm_list_next(j)) {
                                alpm_depend_t *optdep = j->data;
-                               if(alpm_find_satisfier(lp, optdep->name)) {
+                               char *optstring = 
alpm_dep_compute_string(optdep);
+                               if(alpm_find_satisfier(lp, optstring)) {
                                        alpm_event_optdep_removal_t event = {
                                                .type = 
ALPM_EVENT_OPTDEP_REMOVAL,
                                                .pkg = pkg,
diff --git a/src/pacman/util.c b/src/pacman/util.c
index e613c75..e2c9900 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1201,9 +1201,9 @@ static char *make_optstring(alpm_depend_t *optdep)
        alpm_db_t *localdb = alpm_get_localdb(config->handle);
        char *optstring = alpm_dep_compute_string(optdep);
        char *status = NULL;
-       if(alpm_find_satisfier(alpm_db_get_pkgcache(localdb), optdep->name)) {
+       if(alpm_find_satisfier(alpm_db_get_pkgcache(localdb), optstring)) {
                status = _(" [installed]");
-       } else if(alpm_find_satisfier(alpm_trans_get_add(config->handle), 
optdep->name)) {
+       } else if(alpm_find_satisfier(alpm_trans_get_add(config->handle), 
optstring)) {
                status = _(" [pending]");
        }
        if(status) {
-- 
2.7.1

Reply via email to