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:
Matthew Leeds authored and Atomic Bot committed 2018-07-30 17:19:12 +00:00
1 parent fb36b62f33
commit 6869bada49
7 files changed
+115 -14

No files matched your search

+6
View File
@@ -2202,6 +2202,12 @@ ostree_repo_commit_transaction (OstreeRepo *self,
return FALSE;
g_clear_pointer (&self->txn.collection_refs, g_hash_table_destroy);
/* Update the summary if change-update-summary is set, because doing so was
* delayed for each ref change during the transaction.
*/
if (!_ostree_repo_maybe_regenerate_summary (self, cancellable, error))
return FALSE;
self->in_transaction = FALSE;
if (!ot_ensure_unlinked_at (self->repo_dir_fd, "transaction", 0))