[gnome-software/uajain/set-no-pull-autoupdate] flatpak: Mark the transaction with --no-pull for autoupdating apps



commit 9b966cdab1124d6555dbb5b6b5e284d73fe42913
Author: Umang Jain <umang endlessm com>
Date:   Fri Oct 4 12:40:15 2019 +0530

    flatpak: Mark the transaction with --no-pull for autoupdating apps
    
    Autoupdates code path is essentially a GS_PLUGIN_ACTION_DOWNLOAD
    followed by a GS_PLUGIN_ACTION_UPDATE action. The download action
    sets the --no-deploy flag on the transaction so that all the
    update gets downloaded to local cache but does not get deployed (yet).
    
    Hence, the upate action should primarily execute the deployment
    phase for the downloads fetched via GS_PLUGIN_ACTION_DOWNLOAD.
    Flatpak-cli equivalent is : flatpak update --no-pull
    
    It was discovered that this wasn't the case in gnome-software.
    Without the --no-pull flag in autoupdates case, GS_PLUGIN_ACTION_UPDATE
    will try to fetch/query the outstanding updates again.
    Hence, mark the transaction with --no-pull if we discover
    an autoupdate is in progress.
    
    The bug was noticed while investigating a larger problem in
    https://gitlab.gnome.org/GNOME/gnome-software/issues/819

 plugins/flatpak/gs-plugin-flatpak.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 228dedbc..a91a4c12 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -737,6 +737,7 @@ gs_plugin_flatpak_update (GsPlugin *plugin,
                          GError **error)
 {
        g_autoptr(FlatpakTransaction) transaction = NULL;
+       gboolean is_auto_update = !gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE);
 
        /* build and run transaction */
        transaction = _build_transaction (plugin, flatpak, cancellable, error);
@@ -745,6 +746,10 @@ gs_plugin_flatpak_update (GsPlugin *plugin,
                return FALSE;
        }
 
+       /* Update action on auto updates is essentially a deploy operation. */
+       if (is_auto_update)
+               flatpak_transaction_set_no_pull (transaction, TRUE);
+
        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;


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