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




commit 7824fdc70ae803ff3a8b7975acf6f3c9b25a7763
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 b04a4e427..60e206ff9 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -84,6 +84,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;
 }
 
@@ -1015,10 +1017,10 @@ gs_plugin_refine_from_id (GsPluginAppstream    *self,
        /* 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 (self->silo, xpath->str, 0, &error_local);
@@ -1072,9 +1074,9 @@ gs_plugin_refine_from_pkgname (GsPluginAppstream    *self,
                locker = g_rw_lock_reader_locker_new (&self->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 (self->silo, xpath->str, &error_local);
                if (component == NULL) {


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