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



commit 9dd5be703fa15c904e710fa5f4d4f3acb888ceb5
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 |   45 +++++++++++++++--------------
 1 files changed, 23 insertions(+), 22 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 316032a..8f8b8fc 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -338,6 +338,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");
@@ -777,6 +778,28 @@ gs_plugin_refine (GsPlugin *plugin,
                        goto out;
        }
 
+       /* set the package-id for an installed desktop file */
+       ptask = as_profile_start_literal (plugin->profile,
+                                         "packagekit-refine[desktop-filename->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;
+       }
+       as_profile_task_free (ptask);
+
        /* can we resolve in one go? */
        ptask = as_profile_start_literal (plugin->profile, "packagekit-refine[name->id]");
        for (l = *list; l != NULL; l = l->next) {
@@ -803,28 +826,6 @@ gs_plugin_refine (GsPlugin *plugin,
        }
        as_profile_task_free (ptask);
 
-       /* set the package-id for an installed desktop file */
-       ptask = as_profile_start_literal (plugin->profile,
-                                         "packagekit-refine[desktop-filename->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;
-       }
-       as_profile_task_free (ptask);
-
        /* any update details missing? */
        ptask = as_profile_start_literal (plugin->profile,
                                          "packagekit-refine[id->update-details]");


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