[gnome-software/gnome-3-18] Fix refining for apps that have no AppStream metadata



commit 93d34a9b9bb1cda5f02f6b85a300ffa45226616a
Author: Kalev Lember <klember redhat com>
Date:   Wed Oct 14 11:44:56 2015 +0200

    Fix refining for apps that have no AppStream metadata
    
    When dealing with apps that only have a local desktop file and no
    AppStream metadata, make sure to refine based on the desktop file first.
    Doing so sets up the source mapping and ensures that further refining
    based on the source package works.
    
    This makes local apps correctly show version info.

 src/plugins/gs-plugin-packagekit-refine.c |   47 +++++++++++++++--------------
 1 files changed, 24 insertions(+), 23 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 4f1ec3c..92d13e9 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -336,6 +336,7 @@ gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin,
        if (packages->len == 1) {
                PkPackage *package;
                package = g_ptr_array_index (packages, 0);
+               gs_app_add_source (app, pk_package_get_name (package));
                gs_app_add_source_id (app, pk_package_get_id (package));
                gs_app_set_state (app, AS_APP_STATE_INSTALLED);
                gs_app_set_management_plugin (app, "PackageKit");
@@ -715,6 +716,29 @@ gs_plugin_refine (GsPlugin *plugin,
                        goto out;
        }
 
+       /* set the package-id for an installed desktop file */
+       profile_id = "packagekit-refine[desktop-filename->id]";
+       gs_profile_start (plugin->profile, profile_id);
+       for (l = *list; l != NULL; l = l->next) {
+               if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION) == 0)
+                       continue;
+               app = GS_APP (l->data);
+               if (gs_app_get_source_id_default (app) != NULL)
+                       continue;
+               tmp = gs_app_get_metadata_item (app, "DataDir::desktop-filename");
+               if (tmp == NULL)
+                       continue;
+               ret = gs_plugin_packagekit_refine_from_desktop (plugin,
+                                                               app,
+                                                               tmp,
+                                                               cancellable,
+                                                               error);
+               if (!ret)
+                       goto out;
+       }
+       gs_profile_stop (plugin->profile, profile_id);
+       profile_id = NULL;
+
        /* can we resolve in one go? */
        profile_id = "packagekit-refine[name->id]";
        gs_profile_start (plugin->profile, profile_id);
@@ -743,29 +767,6 @@ gs_plugin_refine (GsPlugin *plugin,
        gs_profile_stop (plugin->profile, profile_id);
        profile_id = NULL;
 
-       /* set the package-id for an installed desktop file */
-       profile_id = "packagekit-refine[desktop-filename->id]";
-       gs_profile_start (plugin->profile, profile_id);
-       for (l = *list; l != NULL; l = l->next) {
-               if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION) == 0)
-                       continue;
-               app = GS_APP (l->data);
-               if (gs_app_get_source_id_default (app) != NULL)
-                       continue;
-               tmp = gs_app_get_metadata_item (app, "DataDir::desktop-filename");
-               if (tmp == NULL)
-                       continue;
-               ret = gs_plugin_packagekit_refine_from_desktop (plugin,
-                                                               app,
-                                                               tmp,
-                                                               cancellable,
-                                                               error);
-               if (!ret)
-                       goto out;
-       }
-       gs_profile_stop (plugin->profile, profile_id);
-       profile_id = NULL;
-
        /* any update details missing? */
        profile_id = "packagekit-refine[id->update-details]";
        gs_profile_start (plugin->profile, profile_id);


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