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
This commit is contained in:
parent
371b4a5e7e
commit
73ba3eb686
|
|
@ -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 =
|
GLnxFileReplaceFlags replaceflag =
|
||||||
pull_data->repo->disable_fsync ? GLNX_FILE_REPLACE_NODATASYNC : 0;
|
pull_data->repo->disable_fsync ? GLNX_FILE_REPLACE_NODATASYNC : 0;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ function verify_initial_contents() {
|
||||||
assert_file_has_content baz/cow '^moo$'
|
assert_file_has_content baz/cow '^moo$'
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "1..23"
|
echo "1..25"
|
||||||
|
|
||||||
# Try both syntaxes
|
# Try both syntaxes
|
||||||
repo_init --no-gpg-verify
|
repo_init --no-gpg-verify
|
||||||
|
|
@ -57,6 +57,33 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo fsck
|
||||||
$OSTREE show main >/dev/null
|
$OSTREE show main >/dev/null
|
||||||
echo "ok pull mirror"
|
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}
|
cd ${test_tmpdir}
|
||||||
rm checkout-origin-main -rf
|
rm checkout-origin-main -rf
|
||||||
$OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main
|
$OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue