[gnome-software/mwleeds/fix-deprecated-install: 126/127] flatpak: Avoid plugin cache for temp installation




commit 31e5e6dd774227d7953f41eb70abcd93bc81a784
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Fri Nov 12 08:31:29 2021 -0800

    flatpak: Avoid plugin cache for temp installation
    
    Without this patch we get the unfortunate behavior that the GsApp object
    returned by gs_flatpak_create_app() in gs_flatpak_file_to_app_ref() does
    not have its metadata set correctly despite the info being available in
    the FlatpakRef object passed in to gs_flatpak_create_app() (e.g. the
    flatpak ref name and arch are unset). See
    https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/1087#note_1305237
    
    (Milan came up with this patch)

 plugins/flatpak/gs-flatpak.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 63519e6a7..15adbe7a8 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -363,10 +363,12 @@ gs_flatpak_create_app (GsFlatpak *self,
        if (origin != NULL) {
                gs_flatpak_set_app_origin (self, app, origin, xremote, cancellable);
 
-               /* return the ref'd cached copy, only if the origin is known */
-               app_cached = gs_plugin_cache_lookup (self->plugin, gs_app_get_unique_id (app));
-               if (app_cached != NULL)
-                       return app_cached;
+               if (!(self->flags & GS_FLATPAK_FLAG_IS_TEMPORARY)) {
+                       /* return the ref'd cached copy, only if the origin is known */
+                       app_cached = gs_plugin_cache_lookup (self->plugin, gs_app_get_unique_id (app));
+                       if (app_cached != NULL)
+                               return app_cached;
+               }
        }
 
        /* fallback values */


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