[gnome-software] Revert "flatpak: Construct one big transaction for all updates"



commit eee60ee8905b73bb874a4900a261ad1b54f958d8
Author: Kalev Lember <klember redhat com>
Date:   Thu Oct 4 11:37:56 2018 +0200

    Revert "flatpak: Construct one big transaction for all updates"
    
    Sadly, this regressed error events. Failures from update_app()
    automatically get apps associated to the error events, but that doesn't
    happen for update(). Not having apps listed in events makes GsShell
    explode with criticals and "(NULL)"s in place where app names should be.
    
    Revert back to using update() for now until we figure out how to fix the
    events and/or add more translated error events strings that don't need
    app names in them.
    
    This reverts commit 318a4f29da0823353eec10e968414ce811cb857f.

 plugins/flatpak/gs-plugin-flatpak.c | 53 +++++++++++++------------------------
 1 file changed, 18 insertions(+), 35 deletions(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 37f104e8..01d13606 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -678,22 +678,17 @@ gs_plugin_app_install (GsPlugin *plugin,
 }
 
 gboolean
-gs_plugin_update (GsPlugin *plugin,
-                  GsAppList *list,
-                  GCancellable *cancellable,
-                  GError **error)
+gs_plugin_update_app (GsPlugin *plugin,
+                     GsApp *app,
+                     GCancellable *cancellable,
+                     GError **error)
 {
        GsFlatpak *flatpak;
        g_autoptr(FlatpakTransaction) transaction = NULL;
-       g_autoptr(GsAppList) list_tmp = gs_app_list_new ();
+       g_autofree gchar *ref = NULL;
 
        /* not supported */
-       for (guint i = 0; i < gs_app_list_length (list); i++) {
-               GsApp *app = gs_app_list_index (list, i);
-               flatpak = gs_plugin_flatpak_get_handler (plugin, app);
-               if (flatpak != NULL)
-                       gs_app_list_add (list_tmp, app);
-       }
+       flatpak = gs_plugin_flatpak_get_handler (plugin, app);
        if (flatpak == NULL)
                return TRUE;
 
@@ -703,20 +698,14 @@ gs_plugin_update (GsPlugin *plugin,
                gs_flatpak_error_convert (error);
                return FALSE;
        }
-
-       for (guint i = 0; i < gs_app_list_length (list_tmp); i++) {
-               GsApp *app = gs_app_list_index (list_tmp, i);
-               g_autofree gchar *ref = NULL;
-
-               ref = gs_flatpak_app_get_ref_display (app);
-               if (!flatpak_transaction_add_update (transaction, ref, NULL, NULL, error)) {
-                       g_prefix_error (error, "failed to add update ref %s: ", ref);
-                       gs_flatpak_error_convert (error);
-                       return FALSE;
-               }
+       ref = gs_flatpak_app_get_ref_display (app);
+       if (!flatpak_transaction_add_update (transaction, ref, NULL, NULL, error)) {
+               g_prefix_error (error, "failed to add update ref %s: ", ref);
+               gs_flatpak_error_convert (error);
+               return FALSE;
        }
-
        if (!gs_flatpak_transaction_run (transaction, cancellable, error)) {
+               g_prefix_error (error, "failed to run transaction for %s: ", ref);
                gs_flatpak_error_convert (error);
                return FALSE;
        }
@@ -727,18 +716,12 @@ gs_plugin_update (GsPlugin *plugin,
                gs_flatpak_error_convert (error);
                return FALSE;
        }
-       for (guint i = 0; i < gs_app_list_length (list_tmp); i++) {
-               GsApp *app = gs_app_list_index (list_tmp, i);
-               g_autofree gchar *ref = NULL;
-
-               ref = gs_flatpak_app_get_ref_display (app);
-               if (!gs_flatpak_refine_app (flatpak, app,
-                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME,
-                                           cancellable, error)) {
-                       g_prefix_error (error, "failed to run refine for %s: ", ref);
-                       gs_flatpak_error_convert (error);
-                       return FALSE;
-               }
+       if (!gs_flatpak_refine_app (flatpak, app,
+                                   GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME,
+                                   cancellable, error)) {
+               g_prefix_error (error, "failed to run refine for %s: ", ref);
+               gs_flatpak_error_convert (error);
+               return FALSE;
        }
        return TRUE;
 }


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