[gnome-software] flatpak: Fix multiple flatpak refreshes with new libflatpak



commit 29d1b0eb510a4e3d296886e9270391f60f778564
Author: Richard Hughes <richard hughsie com>
Date:   Tue May 1 12:31:12 2018 +0100

    flatpak: Fix multiple flatpak refreshes with new libflatpak
    
    In the latest flatpak release flatpak_installation_update() started returning
    (the arguably correct) ALREADY_INSTALLED error code when we call the method
    flatpak_installation_update(NO_DEPLOY) on an already-downloaded ref.
    
    Since there's no way to know if a commit has been downloaded race-free, just
    handle the error and continue downloading the other refs if required.

 plugins/flatpak/gs-flatpak.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index eccba081..6a424ed8 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1395,6 +1395,7 @@ gs_flatpak_refresh (GsFlatpak *self,
                g_autoptr(FlatpakInstalledRef) xref2 = NULL;
                g_autoptr(GsApp) app_dl = NULL;
                g_autoptr(GsFlatpakProgressHelper) phelper = NULL;
+               g_autoptr(GError) error_local = NULL;
 
                /* try to create a GsApp so we can do progress reporting */
                app_dl = gs_flatpak_create_installed (self, xref, NULL);
@@ -1410,8 +1411,15 @@ gs_flatpak_refresh (GsFlatpak *self,
                                                     flatpak_ref_get_arch (FLATPAK_REF (xref)),
                                                     flatpak_ref_get_branch (FLATPAK_REF (xref)),
                                                     gs_flatpak_progress_cb, phelper,
-                                                    cancellable, error);
+                                                    cancellable, &error_local);
                if (xref2 == NULL) {
+                       if (g_error_matches (error_local,
+                                            FLATPAK_ERROR,
+                                            FLATPAK_ERROR_ALREADY_INSTALLED)) {
+                               g_debug ("ignoring: %s", error_local->message);
+                               continue;
+                       }
+                       g_propagate_error (error, g_steal_pointer (&error_local));
                        gs_flatpak_error_convert (error);
                        return FALSE;
                }


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