summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2021-05-17 10:22:43 +0200
committerAlexander Larsson <alexl@redhat.com>2021-05-19 09:49:30 +0200
commit51ac8e159039425c3be9bb9f9556051f912312b3 (patch)
treec0159a6037f4f8384de2aef868e14ae993fe4dee
parent540bcda3bd70c5bc2e0506d65db2462407fa9cb3 (diff)
downloadflatpak-51ac8e159039425c3be9bb9f9556051f912312b3.tar.gz
builtin-utils: Use shared helper
This uses the new flatpak_remote_state_ensure_subsummary_all_arches() helper in ensure_remote_state_all_arches().
-rw-r--r--app/flatpak-builtins-utils.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c
index e3de1f8f..bec64a2e 100644
--- a/app/flatpak-builtins-utils.c
+++ b/app/flatpak-builtins-utils.c
@@ -1388,6 +1388,7 @@ get_remote_state (FlatpakDir *dir,
return state;
}
+/* Note: cached == TRUE here means prefer-cache, not only-cache */
gboolean
ensure_remote_state_arch (FlatpakDir *dir,
FlatpakRemoteState *state,
@@ -1427,6 +1428,7 @@ ensure_remote_state_arch_for_ref (FlatpakDir *dir,
return ensure_remote_state_arch (dir, state, ref_arch, cached, only_sideloaded,cancellable, error);
}
+/* Note: cached == TRUE here means prefer-cache, not only-cache */
gboolean
ensure_remote_state_all_arches (FlatpakDir *dir,
FlatpakRemoteState *state,
@@ -1435,15 +1437,19 @@ ensure_remote_state_all_arches (FlatpakDir *dir,
GCancellable *cancellable,
GError **error)
{
- if (state->index_ht == NULL)
+ if (only_sideloaded)
return TRUE;
- GLNX_HASH_TABLE_FOREACH (state->index_ht, const char *, arch)
+ if (cached)
{
- if (!ensure_remote_state_arch (dir, state, arch,
- cached, only_sideloaded,
- cancellable, error))
+ /* First try cached, this will not error on uncached arches */
+ if (!flatpak_remote_state_ensure_subsummary_all_arches (state, dir, TRUE, cancellable, error))
return FALSE;
}
+
+ /* Then download rest */
+ if (!flatpak_remote_state_ensure_subsummary_all_arches (state, dir, FALSE, cancellable, error))
+ return FALSE;
+
return TRUE;
}