[gnome-software/wip/jrocha/update-remote-metadata] flatpak: add update_remote_sync call to appstream refresh



commit 3bacaa81e55be4d4c82827191823e8fa1b5a38e2
Author: Robert McQueen <rob endlessm com>
Date:   Sat Jan 27 17:12:48 2018 +0100

    flatpak: add update_remote_sync call to appstream refresh
    
    This applies changes to the flatpak remote which come from the summary file,
    such as updated keys, titles or the URL. Adding it into the appstream refresh
    function means it's behind the timestamp checks and skipping broken remotes,
    which avoids adding network roundtrips to the refresh.  libflatpak caches the
    summary file in the common case that the remote details have not changed.
    
    https://phabricator.endlessm.com/T20328

 plugins/flatpak/gs-flatpak.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index a34eaf27..d4528058 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -595,6 +595,7 @@ gs_flatpak_refresh_appstream_remote (GsFlatpak *self,
        g_autoptr(AsProfileTask) ptask = NULL;
        g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (self->plugin));
        g_autoptr(GsFlatpakProgressHelper) phelper = NULL;
+       g_autoptr(GError) local_error = NULL;
 
        ptask = as_profile_start (gs_plugin_get_profile (self->plugin),
                                  "%s::refresh-appstream{%s}",
@@ -606,6 +607,18 @@ gs_flatpak_refresh_appstream_remote (GsFlatpak *self,
        str = g_strdup_printf (_("Getting flatpak metadata for %s…"), remote_name);
        gs_app_set_summary_missing (app_dl, str);
        gs_plugin_status_update (self->plugin, app_dl, GS_PLUGIN_STATUS_DOWNLOADING);
+
+       if (!flatpak_installation_update_remote_sync (self->installation,
+                                                     remote_name,
+                                                     cancellable,
+                                                     &local_error)) {
+               g_debug ("Failed to update metadata for remote %s: %s\n",
+                        remote_name, local_error->message);
+               gs_flatpak_error_convert (&local_error);
+               g_propagate_error (error, g_steal_pointer (&local_error));
+               return FALSE;
+       }
+
 #if FLATPAK_CHECK_VERSION(0,9,4)
        phelper = gs_flatpak_progress_helper_new (self->plugin, app_dl);
        if (!flatpak_installation_update_appstream_full_sync (self->installation,


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