[gnome-software] appstream: Don't compare appstream origin to package origin



commit 047a077a0ac308fabe002ad3099b8e1f2f24eccd
Author: Kalev Lember <klember redhat com>
Date:   Thu Mar 15 11:23:52 2018 +0100

    appstream: Don't compare appstream origin to package origin
    
    Use new as_utils_unique_id_match() from appstream-glib 0.7.8 to ignore
    origin when matching AsApp to GsApp. In Fedora, we have all of system
    appstream coming from system-installed appstream-data package that has
    origin "fedora", but actual packages come from e.g. "updates-testing"
    which doesn't match up.

 plugins/core/gs-plugin-appstream.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 9ca09111..3cd95c58 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -527,11 +527,28 @@ gs_plugin_refine_wildcard (GsPlugin *plugin,
                g_autoptr(GsApp) new = NULL;
 
                /* is compatible */
+#if AS_CHECK_VERSION(0,7,8)
+               if (!as_utils_unique_id_match (gs_app_get_unique_id (app),
+                                              as_app_get_unique_id (item),
+                                              AS_UNIQUE_ID_MATCH_FLAG_SCOPE |
+                                              AS_UNIQUE_ID_MATCH_FLAG_BUNDLE_KIND |
+                                              /* don't match origin as AsApp appstream
+                                               * origin can differ from package origin */
+                                              AS_UNIQUE_ID_MATCH_FLAG_KIND |
+                                              AS_UNIQUE_ID_MATCH_FLAG_ID |
+                                              AS_UNIQUE_ID_MATCH_FLAG_BRANCH)) {
+                       g_debug ("does not match unique ID constraints: %s, %s",
+                                gs_app_get_unique_id (app),
+                                as_app_get_unique_id (item));
+                       continue;
+               }
+#else
                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;
                }
+#endif
 
                /* does the app have an installation method */
                if (as_app_get_pkgname_default (item) == NULL &&


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