[gnome-software/gnome-3-32] core: Set the Flatpak branch from the bundle ID



commit 2db6ab0a63630ad2117664ebbe73888e1def471f
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jun 25 13:49:37 2019 +0100

    core: Set the Flatpak branch from the bundle ID
    
    It's important to set this before early as the branch is used in the unique ID.
    
    Fixes half of https://gitlab.gnome.org/GNOME/gnome-software/issues/684

 plugins/core/gs-appstream.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index de54a20d..b6f60f9c 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -834,6 +834,22 @@ gs_appstream_refine_app (GsPlugin *plugin,
                        const gchar *kind = xb_node_get_attr (bundle, "type");
                        gs_app_add_source (app, xb_node_get_text (bundle));
                        gs_app_set_bundle_kind (app, as_bundle_kind_from_string (kind));
+
+                       /* get the type/name/arch/branch */
+                       if (gs_app_get_bundle_kind (app) == AS_BUNDLE_KIND_FLATPAK) {
+                               g_auto(GStrv) split = g_strsplit (xb_node_get_text (bundle), "/", -1);
+                               if (g_strv_length (split) != 4) {
+                                       g_set_error (error,
+                                                    GS_PLUGIN_ERROR,
+                                                    GS_PLUGIN_ERROR_NOT_SUPPORTED,
+                                                    "invalid ID %s for a flatpak ref",
+                                                    xb_node_get_text (bundle));
+                                       return FALSE;
+                               }
+
+                               /* we only need the branch for the unique ID */
+                               gs_app_set_branch (app, split[3]);
+                       }
                }
        }
 


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