[ostree] pull: Copy the upstream summary file when doing a pull --mirror
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull: Copy the upstream summary file when doing a pull --mirror
- Date: Thu, 12 Feb 2015 16:44:00 +0000 (UTC)
commit 1fdecbd263f5a0265dbabc6a1f494e9fb721118e
Author: Colin Walters <walters verbum org>
Date: Wed Feb 4 14:49:22 2015 -0500
pull: Copy the upstream summary file when doing a pull --mirror
While it could be regenerated downstream, there might be other
metadata upstream, and the goal here is a mirror.
https://bugzilla.gnome.org/show_bug.cgi?id=739377
src/libostree/ostree-repo-pull.c | 12 ++++++++++++
tests/test-pull-mirror-summary.sh | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index fd19d68..d3e228c 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -58,6 +58,7 @@ typedef struct {
gboolean gpg_verify;
+ GBytes *summary_data;
GVariant *summary;
GPtrArray *static_delta_superblocks;
GHashTable *expected_commit_sizes; /* Maps commit checksum to known size */
@@ -1864,6 +1865,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
gs_unref_variant GVariant *refs = NULL;
gsize i, n;
+ pull_data->summary_data = g_bytes_ref (bytes);
pull_data->summary = g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT, bytes, FALSE);
refs = g_variant_get_child_value (pull_data->summary, 0);
n = g_variant_n_children (refs);
@@ -1886,6 +1888,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
"Fetching all refs was requested in mirror mode, but remote repository does not have
a summary");
goto out;
}
+
}
else if (refs_to_fetch != NULL)
{
@@ -2061,6 +2064,14 @@ ostree_repo_pull_with_options (OstreeRepo *self,
}
}
+ if (pull_data->is_mirror && pull_data->summary_data)
+ {
+ if (!ot_file_replace_contents_at (pull_data->repo->repo_dir_fd, "summary",
+ pull_data->summary_data, !pull_data->repo->disable_fsync,
+ cancellable, error))
+ goto out;
+ }
+
if (!ostree_repo_commit_transaction (pull_data->repo, NULL, cancellable, error))
goto out;
@@ -2127,6 +2138,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
g_free (pull_data->remote_name);
if (pull_data->base_uri)
soup_uri_free (pull_data->base_uri);
+ g_clear_pointer (&pull_data->summary_data, (GDestroyNotify) g_bytes_unref);
g_clear_pointer (&pull_data->summary, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&pull_data->static_delta_superblocks, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&pull_data->commit_to_depth, (GDestroyNotify) g_hash_table_unref);
diff --git a/tests/test-pull-mirror-summary.sh b/tests/test-pull-mirror-summary.sh
index a09b152..2a8a293 100755
--- a/tests/test-pull-mirror-summary.sh
+++ b/tests/test-pull-mirror-summary.sh
@@ -41,6 +41,7 @@ mkdir repo
ostree --repo=repo init --mode=archive-z2
ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo
ostree --repo=repo pull --mirror origin
+assert_has_file repo/summary
ostree --repo=repo checkout -U main main-copy
assert_file_has_content main-copy/baz/cow "moo"
ostree --repo=repo checkout -U other other-copy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]