From fefd42e83b0ba9bfe56302f255975dcbea3ce533 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 1 May 2018 11:20:10 -0700 Subject: [PATCH] dir: make optional summary really optional We should not require a collection ID to be set for this to actually be optional. Doing so will make us require a network connection for flatpak installs and updates even in case we already have the requested ref available. A use-case that breaks is pulling a ref beforehand (e.g. using ostree pull, or flatpak with FLATPAK_INSTALL_FLAGS_NO_DEPLOY), and later deploying it explicitly at a time when network is not available anymore (e.g. during boot time), using FLATPAK_INSTALL_FLAGS_NO_PULL. This also means that creating a FlatpakRemoteState object for a disabled remote no longer causes an error as long as the summary is optional, so installing .flatpak bundles works again. Fixes https://github.com/flatpak/flatpak/issues/1636 Closes: #1637 Approved by: alexlarsson --- common/flatpak-dir.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 320313c7..f7317dc2 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -8254,7 +8254,7 @@ _flatpak_dir_get_remote_state (FlatpakDir *self, } else { - if (optional && state->collection_id != NULL) + if (optional) { g_debug ("Failed to download optional summary"); } @@ -8342,10 +8342,12 @@ flatpak_dir_get_remote_state_for_summary (FlatpakDir *self, } /* This is an alternative way to get the remote state that doesn't - * error out if the summary or metadata is not available in the p2p - * case. For example, we want to be able to update an app even when + * error out if the summary or metadata is not available. + * For example, we want to be able to update an app even when * we can't talk to the main repo, but there is a local (p2p/sdcard) - * source for apps. + * source for apps, and we want to be able to deploy a ref without pulling it, + * e.g. because we are installing with FLATPAK_INSTALL_FLAGS_NO_PULL, and we + * already pulled it out of band beforehand. */ FlatpakRemoteState * flatpak_dir_get_remote_state_optional (FlatpakDir *self,