[gnome-software/wip/kalev/flatpak-version-matching-fixes: 8/9] flatpak: Use the source, rather than reconstructing flatpak ID



commit e7d2b20c33ba909042b560292efe1f798f846aa9
Author: Kalev Lember <klember redhat com>
Date:   Mon Jul 8 16:00:01 2019 +0300

    flatpak: Use the source, rather than reconstructing flatpak ID
    
    Instead of using gs_flatpak_app_get_ref_display that reconstructs the
    flatpak ID from parts, just use the GsApp source that already has what
    we need.
    
    https://gitlab.gnome.org/GNOME/gnome-software/issues/684

 plugins/flatpak/gs-flatpak.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index a95a192a..d0b993bf 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2124,20 +2124,19 @@ gs_flatpak_refine_appstream (GsFlatpak *self,
                             GError **error)
 {
        const gchar *origin = gs_app_get_origin (app);
-       g_autofree gchar *ref_display = NULL;
-       g_autofree gchar *ref_display_safe = NULL;
+       const gchar *source = gs_app_get_source_default (app);
+       g_autofree gchar *source_safe = NULL;
        g_autofree gchar *xpath = NULL;
        g_autoptr(GError) error_local = NULL;
        g_autoptr(XbNode) component = NULL;
 
-       if (gs_flatpak_app_get_ref_name (app) == NULL)
+       if (origin == NULL || source == NULL)
                return TRUE;
 
-       /* find using ID and origin */
-       ref_display = gs_flatpak_app_get_ref_display (app);
-       ref_display_safe = xb_string_escape (ref_display);
+       /* find using source and origin */
+       source_safe = xb_string_escape (source);
        xpath = g_strdup_printf ("components[@origin='%s']/component/bundle[@type='flatpak'][text()='%s']/..",
-                                origin, ref_display_safe);
+                                origin, source_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",


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