mirror of
https://github.com/flatpak/flatpak.git
synced 2026-08-07 05:46:06 -04:00
extra-data: Simplify extra-data progress setup
We need to get the commit object to setup the extra-data progress information, and this is currently done using a complex pull operation to a temporary repo. According to https://github.com/flatpak/flatpak/issues/3515 it even causes an unecessary download of the summary in some cases. Now that we don't need to support p2p we can instead directly download the commit object using a simple http operation (or from the sideload repos), as we know the commit id at this point anyway.
This commit is contained in:
1 parent
d20a8ccdfd
commit
6deb23a322
1 file changed
+4
-33
+4
-33
@@ -4611,40 +4611,11 @@ flatpak_dir_setup_extra_data (FlatpakDir *self,
|
|||||||
/* ostree-metadata and appstreams never have extra data, so ignore those */
|
/* ostree-metadata and appstreams never have extra data, so ignore those */
|
||||||
if (g_str_has_prefix (ref, "app/") || g_str_has_prefix (ref, "runtime/"))
|
if (g_str_has_prefix (ref, "app/") || g_str_has_prefix (ref, "runtime/"))
|
||||||
{
|
{
|
||||||
extra_data_sources = flatpak_repo_get_extra_data_sources (repo, rev, cancellable, NULL);
|
g_autoptr(GVariant) commitv = flatpak_remote_state_load_ref_commit (state, self, ref, rev, error);
|
||||||
if (extra_data_sources == NULL)
|
if (commitv == NULL)
|
||||||
{
|
return FALSE;
|
||||||
/* This is a gigantic hack where we download the commit in a temporary transaction
|
|
||||||
* which we then abort after having read the result. We do this to avoid creating
|
|
||||||
* a partial commit in the local repo and a ref that points to it, because that
|
|
||||||
* causes ostree to not use static deltas.
|
|
||||||
* See https://github.com/flatpak/flatpak/issues/3412 for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
|
extra_data_sources = flatpak_commit_get_extra_data_sources (commitv, NULL);
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Pull the commits (and only the commits) to check for extra data
|
|
||||||
* again. Here we don't pass the progress because we don't want any
|
|
||||||
* reports coming out of it. */
|
|
||||||
if (!repo_pull (repo, state,
|
|
||||||
NULL,
|
|
||||||
ref,
|
|
||||||
rev,
|
|
||||||
sideload_repo,
|
|
||||||
token,
|
|
||||||
flatpak_flags,
|
|
||||||
OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY,
|
|
||||||
NULL,
|
|
||||||
cancellable,
|
|
||||||
error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
extra_data_sources = flatpak_repo_get_extra_data_sources (repo, rev, cancellable, NULL);
|
|
||||||
|
|
||||||
if (!ostree_repo_abort_transaction (repo, cancellable, error))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n_extra_data = 0;
|
n_extra_data = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user