Blob Blame History Raw
From 047a077a0ac308fabe002ad3099b8e1f2f24eccd Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Thu, 15 Mar 2018 11:23:52 +0100
Subject: [PATCH] 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 9ca091112231..3cd95c586eae 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 &&
-- 
2.16.2

diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 3cd95c586eae..8e558824caca 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -527,7 +527,7 @@ gs_plugin_refine_wildcard (GsPlugin *plugin,
 		g_autoptr(GsApp) new = NULL;
 
 		/* is compatible */
-#if AS_CHECK_VERSION(0,7,8)
+#if AS_CHECK_VERSION(0,7,7)
 		if (!as_utils_unique_id_match (gs_app_get_unique_id (app),
 		                               as_app_get_unique_id (item),
 		                               AS_UNIQUE_ID_MATCH_FLAG_SCOPE |