[gnome-software/gnome-3-32] flatpak: Use the bundle ID to identify the flatpak component



commit 5cc92681aecfdb15c44d5df6031966d8fe739894
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jun 25 18:22:01 2019 +0100

    flatpak: Use the bundle ID to identify the flatpak component
    
    The ID is not enough to get the right architecture and branch.
    
    Fixes the other half of https://gitlab.gnome.org/GNOME/gnome-software/issues/684

 plugins/flatpak/gs-flatpak.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 684f7ca5..82dd7349 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2117,19 +2117,27 @@ gs_flatpak_refine_appstream (GsFlatpak *self,
                             GsPluginRefineFlags flags,
                             GError **error)
 {
-       const gchar *id = gs_app_get_id (app);
        const gchar *origin = gs_app_get_origin (app);
+       g_autofree gchar *ref_display = NULL;
+       g_autofree gchar *ref_display_safe = NULL;
        g_autofree gchar *xpath = NULL;
+       g_autoptr(GError) error_local = NULL;
        g_autoptr(XbNode) component = NULL;
 
-       if (id == NULL)
+       if (gs_flatpak_app_get_ref_name (app) == NULL)
                return TRUE;
 
        /* find using ID and origin */
-       xpath = g_strdup_printf ("components[@origin='%s']/component/id[text()='%s']/..", origin, id);
-       component = xb_silo_query_first (silo, xpath, NULL);
-       if (component == NULL)
+       ref_display = gs_flatpak_app_get_ref_display (app);
+       ref_display_safe = xb_string_escape (ref_display);
+       xpath = g_strdup_printf ("components[@origin='%s']/component/bundle[@type='flatpak'][text()='%s']/..",
+                                origin, ref_display_safe);
+       component = xb_silo_query_first (silo, xpath, &error_local);
+       if (component == NULL) {
+               g_debug ("no match for %s, cannot fall back to %s: %s",
+                        xpath, gs_app_get_id (app), error_local->message);
                return TRUE;
+       }
        if (!gs_appstream_refine_app (self->plugin, app, silo, component, flags, error))
                return FALSE;
 


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