[gnome-software/wip/hughsie/no-global-cache: 3/8] Match all the unique ID constraints when refining a wildcard



commit 10faa0ed64c84460e83cefcf2b25936fb9f587d4
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 22 14:38:39 2018 +0000

    Match all the unique ID constraints when refining a wildcard

 plugins/core/gs-plugin-appstream.c | 10 ++++++++--
 plugins/flatpak/gs-flatpak.c       |  7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 766bbe63..bc97caeb 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -527,11 +527,17 @@ gs_plugin_refine_wildcard (GsPlugin *plugin,
        /* find all apps when matching any prefixes */
        items = as_store_get_apps_by_id (priv->store, id);
        for (i = 0; i < items->len; i++) {
-               AsApp *item = NULL;
+               AsApp *item = g_ptr_array_index (items, i);
                g_autoptr(GsApp) new = NULL;
 
+               /* is compatible */
+               if (!as_utils_unique_id_equal (gs_app_get_unique_id (app),
+                                              as_app_get_unique_id (item))) {
+                       g_debug ("does not match unique ID constraints");
+                       continue;
+               }
+
                /* does the app have an installation method */
-               item = g_ptr_array_index (items, i);
                if (as_app_get_pkgname_default (item) == NULL &&
                    as_app_get_bundle_default (item) == NULL) {
                        g_debug ("not using %s for wildcard as "
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 97f42ea0..39e39ab1 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2330,6 +2330,13 @@ gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
                AsApp *item = NULL;
                g_autoptr(GsApp) new = NULL;
 
+               /* is compatible */
+               if (!as_utils_unique_id_equal (gs_app_get_unique_id (app),
+                                              as_app_get_unique_id (item))) {
+                       g_debug ("does not match unique ID constraints");
+                       continue;
+               }
+
                /* does the app have an installation method */
                item = g_ptr_array_index (items, i);
                if (as_app_get_bundle_default (item) == NULL) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]