[gnome-software: 1/2] snap: Set snap confinement in refine stage.




commit 11075f0f679feae158660099f53ab564f3c34a61
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Dec 18 10:23:59 2020 +1300

    snap: Set snap confinement in refine stage.
    
    The previous code didn't handle snaps with different confinement in each channel.
    Switching channels with alternatives had no confinement information, and meant
    that classic snaps would fail to install when not using the default channel.

 plugins/snap/gs-plugin-snap.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 4c1c8e11..d4831e18 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -316,7 +316,6 @@ snap_to_app (GsPlugin *plugin, SnapdSnap *snap)
        g_autofree gchar *appstream_id = NULL;
        g_autofree gchar *unique_id = NULL;
        g_autoptr(GsApp) app = NULL;
-       SnapdConfinement confinement;
 
        appstream_id = get_appstream_id (snap);
        switch (snapd_snap_get_snap_type (snap)) {
@@ -350,13 +349,6 @@ snap_to_app (GsPlugin *plugin, SnapdSnap *snap)
        if (gs_plugin_check_distro_id (plugin, "ubuntu"))
                gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
 
-       confinement = snapd_snap_get_confinement (snap);
-       if (confinement != SNAPD_CONFINEMENT_UNKNOWN) {
-               GEnumClass *enum_class = g_type_class_ref (SNAPD_TYPE_CONFINEMENT);
-               gs_app_set_metadata (app, "snap::confinement", g_enum_get_value (enum_class, 
confinement)->value_nick);
-               g_type_class_unref (enum_class);
-       }
-
        return g_steal_pointer (&app);
 }
 
@@ -1035,6 +1027,12 @@ refine_app_with_client (GsPlugin             *plugin,
        gs_app_set_version (app, version);
        gs_app_set_release_date (app, release_date);
 
+       if (confinement != SNAPD_CONFINEMENT_UNKNOWN) {
+               GEnumClass *enum_class = g_type_class_ref (SNAPD_TYPE_CONFINEMENT);
+               gs_app_set_metadata (app, "snap::confinement", g_enum_get_value (enum_class, 
confinement)->value_nick);
+               g_type_class_unref (enum_class);
+       }
+
        if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_KUDOS &&
            priv->system_confinement == SNAPD_SYSTEM_CONFINEMENT_STRICT &&
            confinement == SNAPD_CONFINEMENT_STRICT)


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