[gnome-software/gnome-3-30] flatpak: Fix kind change warnings for addons



commit 1e55bef0473b999ac80cf129916afd7e301aa165
Author: Kalev Lember <klember redhat com>
Date:   Wed Oct 17 11:19:50 2018 +0200

    flatpak: Fix kind change warnings for addons
    
    Don't try to override kind in the flatpak plugin if appstream has
    already set it for us.
    
    08:58:02:0593 Gs  Kind change on com.sublimetext.three.DevUtils from addon to runtime is not OK

 plugins/flatpak/gs-flatpak.c | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index ed83038e..e85a8566 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -98,21 +98,8 @@ gs_flatpak_claim_app_list (GsFlatpak *self, GsAppList *list)
 }
 
 static void
-gs_flatpak_set_metadata (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
+gs_flatpak_set_kind_from_flatpak (GsApp *app, FlatpakRef *xref)
 {
-       /* core */
-       gs_flatpak_claim_app (self, app);
-       gs_app_set_branch (app, flatpak_ref_get_branch (xref));
-       gs_plugin_refine_item_scope (self, app);
-
-       /* flatpak specific */
-       gs_flatpak_app_set_ref_kind (app, flatpak_ref_get_kind (xref));
-       gs_flatpak_app_set_ref_name (app, flatpak_ref_get_name (xref));
-       gs_flatpak_app_set_ref_arch (app, flatpak_ref_get_arch (xref));
-       gs_flatpak_app_set_ref_branch (app, flatpak_ref_get_branch (xref));
-       gs_flatpak_app_set_commit (app, flatpak_ref_get_commit (xref));
-
-       /* map the flatpak kind to the gnome-software kind */
        if (flatpak_ref_get_kind (xref) == FLATPAK_REF_KIND_APP) {
                gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
        } else if (flatpak_ref_get_kind (xref) == FLATPAK_REF_KIND_RUNTIME) {
@@ -132,6 +119,28 @@ gs_flatpak_set_metadata (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
        }
 }
 
+static void
+gs_flatpak_set_metadata (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
+{
+       /* core */
+       gs_flatpak_claim_app (self, app);
+       gs_app_set_branch (app, flatpak_ref_get_branch (xref));
+       gs_plugin_refine_item_scope (self, app);
+
+       /* flatpak specific */
+       gs_flatpak_app_set_ref_kind (app, flatpak_ref_get_kind (xref));
+       gs_flatpak_app_set_ref_name (app, flatpak_ref_get_name (xref));
+       gs_flatpak_app_set_ref_arch (app, flatpak_ref_get_arch (xref));
+       gs_flatpak_app_set_ref_branch (app, flatpak_ref_get_branch (xref));
+       gs_flatpak_app_set_commit (app, flatpak_ref_get_commit (xref));
+
+       /* map the flatpak kind to the gnome-software kind */
+       if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN ||
+           gs_app_get_kind (app) == AS_APP_KIND_GENERIC) {
+               gs_flatpak_set_kind_from_flatpak (app, xref);
+       }
+}
+
 static GsApp *
 gs_flatpak_create_app (GsFlatpak *self, FlatpakRef *xref)
 {


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