[gnome-software/wip/mcrha/flatpak-test-fix] flatpak: Ensure runtime's origin is set in file-to-app plugin action



commit 9ba2adfb346158306ace7e14afe5e2d25f9aa94c
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 3 09:28:57 2022 +0100

    flatpak: Ensure runtime's origin is set in file-to-app plugin action
    
    This fixes the self test of the Flatpak plugin.

 plugins/flatpak/gs-plugin-flatpak.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index fadd3be3b..d8c5bb6d3 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -1684,8 +1684,16 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                if (app == NULL)
                        return FALSE;
        }
-       if (app != NULL)
+       if (app != NULL) {
+               GsApp *runtime = gs_app_get_runtime (app);
+               /* Ensure the origin for the runtime is set */
+               if (runtime != NULL && gs_app_get_origin (runtime) == NULL) {
+                       g_autoptr(GError) error_local = NULL;
+                       if (!gs_plugin_flatpak_refine_app (self, runtime, 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN, cancellable, &error_local))
+                               g_debug ("Failed to refine runtime: %s", error_local->message);
+               }
                gs_app_list_add (list, app);
+       }
        return TRUE;
 }
 


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