config: Add a core/change-update-summary option
This commits adds and implements a boolean repo config option called "change-update-summary" which updates the summary file every time a ref changes (additions, updates, and deletions). The main impetus for this feature is that the `ostree create-usb` and `flatpak create-usb` commands depend on the repo summary being up to date. On the command line you can work around this by asking the user to run `ostree summary --update` but in the case of GNOME Software calling out to `flatpak create-usb` this wouldn't work because it's running as a user and the repo is owned by root. That strategy also means flatpak can't update the repo metadata refs for fear of invalidating the summary. Another use case for this relates to LAN updates. Specifically, the component of eos-updater that generates DNS-SD records advertising ostree refs depends on the repo summary being up to date. Since ostree_repo_regenerate_summary() now takes an exclusive lock, this should be safe to enable. However it's not enabled by default because of the performance cost, and because it's more useful on clients than servers (which likely have another mechanism for updating the summary). Fixes https://github.com/ostreedev/ostree/issues/1664 Closes: #1681 Approved by: jlebon
This commit is contained in:
1 parent
fb36b62f33
commit
6869bada49
7 files changed
+115
-14
No files matched your search
@@ -29,6 +29,7 @@ echo "1..4"
|
||||
setup_test_repository "bare"
|
||||
echo "ok setup"
|
||||
|
||||
# Check that without commit-update-summary set, creating a commit doesn't update the summary
|
||||
mkdir test
|
||||
|
||||
echo hello > test/a
|
||||
@@ -47,6 +48,7 @@ echo "ok commit 2"
|
||||
|
||||
assert_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
|
||||
# Check that with commit-update-summary set, creating a commit updates the summary
|
||||
$OSTREE --repo=repo config set core.commit-update-summary true
|
||||
|
||||
echo hello3 > test/a
|
||||
@@ -56,7 +58,46 @@ echo "ok commit 3"
|
||||
|
||||
assert_not_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
|
||||
$OSTREE --repo=repo config set core.commit-update-summary false
|
||||
|
||||
# Check that summary --update deletes the .sig file
|
||||
touch repo/summary.sig
|
||||
$OSTREE summary --update
|
||||
assert_not_has_file repo/summary.sig
|
||||
|
||||
# Check that without change-update-summary set, adding, changing, or deleting a ref doesn't update the summary
|
||||
$OSTREE summary --update
|
||||
OLD_MD5=$(md5sum repo/summary)
|
||||
$OSTREE commit -b test2 -s "A commit" test
|
||||
|
||||
assert_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
|
||||
$OSTREE reset test test^
|
||||
|
||||
assert_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
|
||||
$OSTREE refs --delete test
|
||||
|
||||
assert_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
|
||||
# Check that with change-update-summary set, adding, changing, or deleting a ref updates the summary
|
||||
$OSTREE --repo=repo config set core.change-update-summary true
|
||||
|
||||
$OSTREE summary --update
|
||||
OLD_MD5=$(md5sum repo/summary)
|
||||
echo hello > test/a
|
||||
$OSTREE commit -b test -s "A commit" test
|
||||
echo hello2 > test/a
|
||||
$OSTREE commit -b test -s "Another commit" test
|
||||
|
||||
assert_not_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
|
||||
OLD_MD5=$(md5sum repo/summary)
|
||||
$OSTREE reset test test^
|
||||
|
||||
assert_not_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
|
||||
OLD_MD5=$(md5sum repo/summary)
|
||||
$OSTREE refs --delete test
|
||||
|
||||
assert_not_streq "$OLD_MD5" "$(md5sum repo/summary)"
|
||||
Reference in new issue
Block a user