summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2020-08-07 16:16:42 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2020-08-24 08:58:08 +0200
commitd57db7074b0d15081290c6a06f7ce7e44aebb632 (patch)
treeee3dcc4adc75c43fc07aa6f7bdb22e21a8f33370
parent254a885879b567923df54ffb69616b3f51a593cf (diff)
downloadflatpak-d57db7074b0d15081290c6a06f7ce7e44aebb632.tar.gz
flatpak-transaction: Don’t update metadata when uninstalling
When uninstalling a single app (an example of a transaction which is entirely local-only), there’s no need to update the repository metadata beforehand — but the code was doing that. This avoids an unnecessary download of the `summary.sig` file (or other repository metadata, depending on what’s out of date) when uninstalling. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r--common/flatpak-transaction.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/flatpak-transaction.c b/common/flatpak-transaction.c
index 5880f08d..b6d108ef 100644
--- a/common/flatpak-transaction.c
+++ b/common/flatpak-transaction.c
@@ -2397,6 +2397,7 @@ flatpak_transaction_update_metadata (FlatpakTransaction *self,
GList *l;
gboolean some_updated = FALSE;
g_autoptr(GHashTable) ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ gboolean local_only = TRUE;
/* Collect all dir+remotes used in this transaction */
@@ -2407,10 +2408,16 @@ flatpak_transaction_update_metadata (FlatpakTransaction *self,
{
FlatpakTransactionOperation *op = l->data;
g_hash_table_add (ht, g_strdup (op->remote));
+ local_only = local_only && transaction_is_local_only (self, op->kind);
}
remotes = (char **) g_hash_table_get_keys_as_array (ht, NULL);
g_hash_table_steal_all (ht); /* Move ownership to remotes */
+ /* Bail early if the entire transaction is local-only, as in that case we
+ * don’t need updated metadata. */
+ if (local_only)
+ return TRUE;
+
/* Update metadata for said remotes */
for (i = 0; remotes[i] != NULL; i++)
{