Blame SOURCES/0001-Improve-the-heuristic-for-detecting-old-style-AppStr.patch

0e9714
From bc31889bf90e14776e4404cd58e9b0244efc4f2e Mon Sep 17 00:00:00 2001
0e9714
From: Kalev Lember <klember@redhat.com>
0e9714
Date: Tue, 9 Jun 2020 21:42:41 +0200
0e9714
Subject: [PATCH] Improve the heuristic for detecting old-style AppStream
0e9714
 override files
0e9714
0e9714
The heuristic was trying to detect old-style AppStream override files
0e9714
that have the following structure:
0e9714
0e9714
      <component type=desktop>
0e9714
        <id>org.kde.amarok.desktop</id>
0e9714
        <categories>
0e9714
          <category>AudioVideo</category>
0e9714
          <category>Featured</category>
0e9714
        </categories>
0e9714
      </component>
0e9714
0e9714
When it found one, it gave it the wildcard quirk to avoid leaking the
0e9714
result to the installed apps list.
0e9714
0e9714
This however incorrectly tripped on old appdata files that didn't
0e9714
specify name and relied on filling the missing name/summary/icon from
0e9714
the desktop file.
0e9714
0e9714
Fix this by tightening the heuristic and also look for
0e9714
<metadata_license> that none of the override files should have.
0e9714
0e9714
This fixes RHEL firefox package to correctly show up when clicking on
0e9714
'Show Details' in GNOME Shell.
0e9714
---
0e9714
 plugins/core/gs-appstream.c | 14 ++++++++------
0e9714
 1 file changed, 8 insertions(+), 6 deletions(-)
0e9714
0e9714
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
0e9714
index a387f2e0..da9ba970 100644
0e9714
--- a/plugins/core/gs-appstream.c
0e9714
+++ b/plugins/core/gs-appstream.c
0e9714
@@ -746,6 +746,13 @@ gs_appstream_refine_app (GsPlugin *plugin,
0e9714
 			gs_app_remove_quirk (app, GS_APP_QUIRK_HIDE_EVERYWHERE);
0e9714
 	}
0e9714
 
0e9714
+	/* try to detect old-style AppStream 'override'
0e9714
+	 * files without the merge attribute */
0e9714
+	if (xb_node_query_text (component, "name", NULL) == NULL &&
0e9714
+	    xb_node_query_text (component, "metadata_license", NULL) == NULL) {
0e9714
+		gs_app_add_quirk (app, GS_APP_QUIRK_IS_WILDCARD);
0e9714
+	}
0e9714
+
0e9714
 	/* set id */
0e9714
 	tmp = xb_node_query_text (component, "id", NULL);
0e9714
 	if (tmp != NULL && gs_app_get_id (app) == NULL)
0e9714
@@ -770,13 +777,8 @@ gs_appstream_refine_app (GsPlugin *plugin,
0e9714
 
0e9714
 	/* set name */
0e9714
 	tmp = xb_node_query_text (component, "name", NULL);
0e9714
-	if (tmp != NULL) {
0e9714
+	if (tmp != NULL)
0e9714
 		gs_app_set_name (app, GS_APP_QUALITY_HIGHEST, tmp);
0e9714
-	} else {
0e9714
-		/* this is a heuristic, but works even with old-style AppStream
0e9714
-		 * files without the merge attribute */
0e9714
-		gs_app_add_quirk (app, GS_APP_QUIRK_IS_WILDCARD);
0e9714
-	}
0e9714
 
0e9714
 	/* set summary */
0e9714
 	tmp = xb_node_query_text (component, "summary", NULL);
0e9714
-- 
0e9714
2.26.2
0e9714