[gnome-software/gnome-41: 4/5] gs-plugin-appstream: Fix some application types not being correctly queried




commit 6812449c353a96e326eb4031873a624eb7a95755
Author: Pablo Correa Gómez <ablocorrea hotmail com>
Date:   Fri Mar 4 18:05:54 2022 +0100

    gs-plugin-appstream: Fix some application types not being correctly queried
    
    The 'console' type never existed; for the 'webapp' legacy type there is
    already a fixup in place to use the 'web-application' type currently
    in use in the specification[1]; and the 'desktop-application' type has been
    for a while the default identifier for desktop applications,
    super-seeding 'desktop'[2], so its fixup has been added.
    
    [1] https://www.freedesktop.org/software/appstream/docs/sect-Metadata-WebApplication.html
    [2] 
https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Application.html#spec-appdata-filespec
    
    squash! gs-plugin-appstream: fixup legacy 'desktop' to 'desktop-application' type

 plugins/core/gs-plugin-appstream.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 950316f2e..42be38a78 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -69,6 +69,8 @@ gs_plugin_appstream_convert_component_kind (const gchar *kind)
 {
        if (g_strcmp0 (kind, "webapp") == 0)
                return "web-application";
+       if (g_strcmp0 (kind, "desktop") == 0)
+               return "desktop-application";
        return kind;
 }
 
@@ -892,10 +894,10 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
        /* look in AppStream then fall back to AppData */
        if (origin && *origin) {
                xb_string_append_union (xpath, 
"components[@origin='%s']/component/id[text()='%s']/../pkgname/..", origin, id);
-               xb_string_append_union (xpath, 
"components[@origin='%s']/component[@type='webapp']/id[text()='%s']/..", origin, id);
+               xb_string_append_union (xpath, 
"components[@origin='%s']/component[@type='web-application']/id[text()='%s']/..", origin, id);
        } else {
                xb_string_append_union (xpath, "components/component/id[text()='%s']/../pkgname/..", id);
-               xb_string_append_union (xpath, "components/component[@type='webapp']/id[text()='%s']/..", id);
+               xb_string_append_union (xpath, 
"components/component[@type='web-application']/id[text()='%s']/..", id);
        }
        xb_string_append_union (xpath, "component/id[text()='%s']/..", id);
        components = xb_silo_query (priv->silo, xpath->str, 0, &error_local);
@@ -950,9 +952,9 @@ gs_plugin_refine_from_pkgname (GsPlugin *plugin,
                locker = g_rw_lock_reader_locker_new (&priv->silo_lock);
 
                /* prefer actual apps and then fallback to anything else */
-               xb_string_append_union (xpath, 
"components/component[@type='desktop']/pkgname[text()='%s']/..", pkgname);
-               xb_string_append_union (xpath, 
"components/component[@type='console']/pkgname[text()='%s']/..", pkgname);
-               xb_string_append_union (xpath, 
"components/component[@type='webapp']/pkgname[text()='%s']/..", pkgname);
+               xb_string_append_union (xpath, 
"components/component[@type='desktop-application']/pkgname[text()='%s']/..", pkgname);
+               xb_string_append_union (xpath, 
"components/component[@type='console-application']/pkgname[text()='%s']/..", pkgname);
+               xb_string_append_union (xpath, 
"components/component[@type='web-application']/pkgname[text()='%s']/..", pkgname);
                xb_string_append_union (xpath, "components/component/pkgname[text()='%s']/..", pkgname);
                component = xb_silo_query_first (priv->silo, xpath->str, &error_local);
                if (component == NULL) {


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