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




commit ca9e58a4d99bd00891cc60abbae1339d29d6ce8f
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 | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 928a24bb6..f9f2f4e17 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 */
@@ -386,7 +388,7 @@ gs_flatpak_create_app (GsFlatpak *self,
         * hash table uses as_utils_data_id_equal() as the equal func and a NULL
         * origin becomes a "*" in gs_utils_build_unique_id().
         */
-       if (origin != NULL)
+       if (origin != NULL && !(self->flags & GS_FLATPAK_FLAG_IS_TEMPORARY))
                gs_plugin_cache_add (self->plugin, NULL, app);
 
        /* no existing match, just steal the temp object */


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