summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexander.larsson@gmail.com>2020-04-01 14:51:14 +0200
committerGitHub <noreply@github.com>2020-04-01 14:51:14 +0200
commit29b553f7f3691fce6d2861267abb24b196f96807 (patch)
treec79cea0bb42dac4ad933dc04adb35aeb5a7a0eff
parentca771eb0245e93bc2fcd32878b68f1bfeb96fa61 (diff)
parent2120b99ac643b31839ebb948859bb1dbf7c3ae61 (diff)
downloadflatpak-29b553f7f3691fce6d2861267abb24b196f96807.tar.gz
Merge pull request #3524 from mwleeds/fix-progress-over-100
Revert "extra-data: Simplify extra-data progress setup"
-rw-r--r--common/flatpak-dir.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index e1e1fdc6..24e228e9 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -4647,11 +4647,40 @@ flatpak_dir_setup_extra_data (FlatpakDir *self,
/* ostree-metadata and appstreams never have extra data, so ignore those */
if (g_str_has_prefix (ref, "app/") || g_str_has_prefix (ref, "runtime/"))
{
- g_autoptr(GVariant) commitv = flatpak_remote_state_load_ref_commit (state, self, ref, rev, token, error);
- if (commitv == NULL)
- return FALSE;
+ extra_data_sources = flatpak_repo_get_extra_data_sources (repo, rev, cancellable, NULL);
+ if (extra_data_sources == NULL)
+ {
+ /* 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.
+ */
- extra_data_sources = flatpak_commit_get_extra_data_sources (commitv, NULL);
+ if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+ 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;