From ea116809d101e362b608b3de93e0a41e27fe46d0 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 20 Nov 2020 13:33:37 +0100 Subject: [PATCH] remote-metadata-update: Don't clean caches if nothing changed This was causing us to never cache the summary in user installations --- common/flatpak-dir.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 41f0428a..069036b1 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -14337,6 +14337,7 @@ flatpak_dir_update_remote_configuration (FlatpakDir *self, gboolean is_oci; g_autoptr(FlatpakRemoteState) local_state = NULL; FlatpakRemoteState *state; + gboolean has_changed = FALSE; /* Initialize if we exit early */ if (updated_out) @@ -14361,7 +14362,6 @@ flatpak_dir_update_remote_configuration (FlatpakDir *self, if (flatpak_dir_use_system_helper (self, NULL)) { - gboolean has_changed = FALSE; gboolean gpg_verify_summary; gboolean gpg_verify; @@ -14432,19 +14432,24 @@ flatpak_dir_update_remote_configuration (FlatpakDir *self, if (!flatpak_dir_remote_clear_cached_summary (self, remote, cancellable, error)) return FALSE; - if (updated_out) - *updated_out = TRUE; } + if (updated_out) + *updated_out = has_changed; + return TRUE; } - if (!flatpak_dir_update_remote_configuration_for_state (self, state, FALSE, updated_out, cancellable, error)) + if (!flatpak_dir_update_remote_configuration_for_state (self, state, FALSE, &has_changed, cancellable, error)) return FALSE; - if (!flatpak_dir_remote_clear_cached_summary (self, remote, cancellable, error)) + if (has_changed && + !flatpak_dir_remote_clear_cached_summary (self, remote, cancellable, error)) return FALSE; + if (updated_out) + *updated_out = has_changed; + return TRUE; }