diff options
author | Alexander Larsson <alexl@redhat.com> | 2017-06-16 10:07:44 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-06-16 15:08:39 +0000 |
commit | 73ba3eb686ef86cea1c4563303e44df87d73e6c6 (patch) | |
tree | 422d7bbce543c1f60be89d7ccdd92110b1386e63 | |
parent | 371b4a5e7e179da26c18ac40ab0a2f66c3d89150 (diff) | |
download | ostree-73ba3eb686ef86cea1c4563303e44df87d73e6c6.tar.gz |
pull: When mirroring, only replace summary if we're doing a full mirror
We're hitting this in flathub, where we have a bunch of local builds,
but we also mirror a few refs from the gnome runtime repo into it.
Its fixable by re-doing the summary, but for a short time the
wrong version is visible.
Fixes https://github.com/ostreedev/ostree/issues/846
Closes: #935
Approved by: cgwalters
-rw-r--r-- | src/libostree/ostree-repo-pull.c | 2 | ||||
-rw-r--r-- | tests/pull-test.sh | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 704a68d2..2c87fd60 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -3518,7 +3518,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, } } - if (pull_data->is_mirror && pull_data->summary_data) + if (pull_data->is_mirror && pull_data->summary_data && !refs_to_fetch && !configured_branches) { GLnxFileReplaceFlags replaceflag = pull_data->repo->disable_fsync ? GLNX_FILE_REPLACE_NODATASYNC : 0; diff --git a/tests/pull-test.sh b/tests/pull-test.sh index 9f74c0d8..24eb16a0 100644 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -35,7 +35,7 @@ function verify_initial_contents() { assert_file_has_content baz/cow '^moo$' } -echo "1..23" +echo "1..25" # Try both syntaxes repo_init --no-gpg-verify @@ -57,6 +57,33 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo fsck $OSTREE show main >/dev/null echo "ok pull mirror" +mkdir otherbranch +echo someothercontent > otherbranch/someothercontent +${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b otherbranch --tree=dir=otherbranch +${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u +rm mirrorrepo -rf +# All refs +ostree_repo_init mirrorrepo --mode=archive-z2 +${CMD_PREFIX} ostree --repo=mirrorrepo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo +${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin +${CMD_PREFIX} ostree --repo=mirrorrepo fsck +for ref in main otherbranch; do + ${CMD_PREFIX} ostree --repo=mirrorrepo rev-parse $ref +done +echo "ok pull mirror (all refs)" + +rm mirrorrepo -rf +ostree_repo_init mirrorrepo --mode=archive-z2 +${CMD_PREFIX} ostree --repo=mirrorrepo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo +# Generate a summary in the mirror +${CMD_PREFIX} ostree --repo=mirrorrepo summary -u +summarysig=$(sha256sum < mirrorrepo/summary | cut -f 1 -d ' ') +# Mirror subset of refs: https://github.com/ostreedev/ostree/issues/846 +${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin main +newsummarysig=$(sha256sum < mirrorrepo/summary | cut -f 1 -d ' ') +assert_streq ${summarysig} ${newsummarysig} +echo "ok pull mirror (ref subset with summary)" + cd ${test_tmpdir} rm checkout-origin-main -rf $OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main |