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
This commit is contained in:
Cosimo Cecchi
2018-05-01 11:20:10 -07:00
committed by Atomic Bot
parent 013ff8d900
commit fefd42e83b

View File

@@ -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,