[gnome-software] packagekit-refine: don't set an error if we don't find the package



commit fc385f36209ddd0a69ec4a28e57f9cd571fe02e6
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Aug 31 16:02:21 2013 +0200

    packagekit-refine: don't set an error if we don't find the package
    
    It's possible that no package is found because the application
    was installed through a mean different than PackageKit. In that
    case we should not set an error, to avoid aborting the entire
    plugin transaction.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707185

 src/plugins/gs-plugin-packagekit-refine.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index a1add54..1d97c43 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -177,18 +177,14 @@ gs_plugin_packagekit_refine_app (GsPlugin *plugin, GsApp *app, GCancellable *can
 
        /* get results */
        packages = pk_results_get_package_array (results);
-       if (packages->len != 1) {
-               ret = FALSE;
-               g_set_error (error,
-                            GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
-                            "failed to to find one package for: %s, %s [%i]",
-                            gs_app_get_id (app), filename, packages->len);
-               goto out;
+       if (packages->len == 1) {
+               package = g_ptr_array_index (packages, 0);
+               gs_app_set_metadata (app, "package-id", pk_package_get_id (package));
+               gs_app_set_state (app, GS_APP_STATE_INSTALLED);
+       } else {
+               g_warning ("Failed to find one package for %s, %s, [%d]",
+                          gs_app_get_id (app), filename, packages->len);
        }
-       package = g_ptr_array_index (packages, 0);
-       gs_app_set_metadata (app, "package-id", pk_package_get_id (package));
-       gs_app_set_state (app, GS_APP_STATE_INSTALLED);
 out:
        if (packages != NULL)
                g_ptr_array_unref (packages);


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