From fb1814c3aad4c307fb1d024b083dcdcff62b2640 Mon Sep 17 00:00:00 2001 From: Mario Sanchez Prada Date: Wed, 23 May 2018 15:19:16 +0100 Subject: [PATCH] lib/installation: Add new FlatpakUpdateFlag to prevent pruning the repo Add a new FLATPAK_UPDATE_FLAGS_NO_PRUNE so that we can specify from clients when we don't want to perform a prune right after updating a flatpak, even if no FLATPAK_UPDATE_FLAGS_NO_PULL flag has been set. https://github.com/flatpak/flatpak/issues/1703 Closes: #1704 Approved by: alexlarsson --- lib/flatpak-installation.c | 4 ++-- lib/flatpak-installation.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/flatpak-installation.c b/lib/flatpak-installation.c index 35dc7232..80ef1d02 100644 --- a/lib/flatpak-installation.c +++ b/lib/flatpak-installation.c @@ -1897,8 +1897,8 @@ flatpak_installation_update_full (FlatpakInstallation *self, if (result == NULL) goto out; - /* We don't get prunable objects if not pulling */ - if (!(flags & FLATPAK_UPDATE_FLAGS_NO_PULL)) + /* We don't get prunable objects if not pulling or if NO_PRUNE is passed */ + if (!(flags & FLATPAK_UPDATE_FLAGS_NO_PULL) && !(flags & FLATPAK_UPDATE_FLAGS_NO_PRUNE)) flatpak_dir_prune (dir_clone, cancellable, NULL); out: diff --git a/lib/flatpak-installation.h b/lib/flatpak-installation.h index fe547e5c..bcd11f0a 100644 --- a/lib/flatpak-installation.h +++ b/lib/flatpak-installation.h @@ -52,6 +52,7 @@ typedef struct * @FLATPAK_UPDATE_FLAGS_NONE: Fetch remote builds and install the latest one (default) * @FLATPAK_UPDATE_FLAGS_NO_DEPLOY: Don't install any new builds that might be fetched * @FLATPAK_UPDATE_FLAGS_NO_PULL: Don't try to fetch new builds from the remote repo + * @FLATPAK_UPDATE_FLAGS_NO_PRUNE: Don't prune the local OSTreee repository after updating * * Flags to alter the behavior of flatpak_installation_update(). */ @@ -60,6 +61,7 @@ typedef enum { FLATPAK_UPDATE_FLAGS_NO_DEPLOY = (1 << 0), FLATPAK_UPDATE_FLAGS_NO_PULL = (1 << 1), FLATPAK_UPDATE_FLAGS_NO_STATIC_DELTAS = (1 << 2), + FLATPAK_UPDATE_FLAGS_NO_PRUNE = (1 << 3), } FlatpakUpdateFlags; /**