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

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