mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-15 05:27:40 -04:00
Don't always create commitpartial files in child repos
We used to always create a commitpartial file in child repo, because ostree doesn't follow parent repos when loading commitpartial state, and when the commit was in the parent repo it would find the commit but no commitpartial and assume the commit was complete and do nothing. However, having a commitpartial file seems to break delta downloads in ostree, as per: https://github.com/ostreedev/ostree/issues/2053 causing us to download too much data when using deltas. So, we now only create a commitpartial if there is one in the parent repo. This still means we will get the ostree problems in case there is one, but in the much more common case we avoid the issue. In order to "fix" the uncommon case we also (separately) cap the reported progress at 100%. (We should probably also fix the upstream ostree issue too.)
This commit is contained in:
@@ -8160,16 +8160,21 @@ flatpak_dir_create_child_repo (FlatpakDir *self,
|
||||
verify + fsync when importing to stable storage */
|
||||
ostree_repo_set_disable_fsync (repo, TRUE);
|
||||
|
||||
/* Create a commitpartial in the child repo to ensure we download everything, because
|
||||
any commitpartial state in the parent will not be inherited */
|
||||
/* Create a commitpartial in the child repo if needed to ensure we download everything, because
|
||||
any commitpartial state in the parent will not otherwise be inherited */
|
||||
if (optional_commit)
|
||||
{
|
||||
g_autofree char *commitpartial_basename = g_strconcat (optional_commit, ".commitpartial", NULL);
|
||||
g_autoptr(GFile) commitpartial =
|
||||
flatpak_build_file (ostree_repo_get_path (repo),
|
||||
g_autoptr(GFile) orig_commitpartial =
|
||||
flatpak_build_file (ostree_repo_get_path (self->repo),
|
||||
"state", commitpartial_basename, NULL);
|
||||
|
||||
g_file_replace_contents (commitpartial, "", 0, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, NULL);
|
||||
if (g_file_query_exists (orig_commitpartial, NULL))
|
||||
{
|
||||
g_autoptr(GFile) commitpartial =
|
||||
flatpak_build_file (ostree_repo_get_path (repo),
|
||||
"state", commitpartial_basename, NULL);
|
||||
g_file_replace_contents (commitpartial, "", 0, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
return g_steal_pointer (&repo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user