diff options
author | Matthew Leeds <matthew.leeds@endlessm.com> | 2018-07-13 15:53:21 -0700 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-07-30 17:19:12 +0000 |
commit | 6869bada49ec414837c2b936a761652c66d3f31e (patch) | |
tree | 5c808e378b3aab1b92dbe2a8bf334e4833db21bc /src/ostree/ot-builtin-commit.c | |
parent | fb36b62f331a7cc5d3d10e53d6db086bf1c18e0c (diff) | |
download | ostree-6869bada49ec414837c2b936a761652c66d3f31e.tar.gz |
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
Diffstat (limited to 'src/ostree/ot-builtin-commit.c')
-rw-r--r-- | src/ostree/ot-builtin-commit.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index c2f78700..ded6522f 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -752,8 +752,8 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio if (!skip_commit) { - gboolean update_summary; guint64 timestamp; + gboolean change_update_summary; if (!opt_no_bindings) { @@ -824,21 +824,32 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error)) goto out; - /* The default for this option is FALSE, even for archive repos, - * because ostree supports multiple processes committing to the same - * repo (but different refs) concurrently, and in fact gnome-continuous - * actually does this. In that context it's best to update the summary - * explicitly instead of automatically here. */ if (!ot_keyfile_get_boolean_with_default (ostree_repo_get_config (repo), "core", - "commit-update-summary", FALSE, - &update_summary, error)) + "change-update-summary", FALSE, + &change_update_summary, error)) goto out; - if (update_summary && !ostree_repo_regenerate_summary (repo, - NULL, - cancellable, - error)) - goto out; + /* No need to update it again if we did for each ref change */ + if (opt_orphan || !change_update_summary) + { + gboolean commit_update_summary; + + /* The default for this option is FALSE, even for archive repos, + * because ostree supports multiple processes committing to the same + * repo (but different refs) concurrently, and in fact gnome-continuous + * actually does this. In that context it's best to update the summary + * explicitly instead of automatically here. */ + if (!ot_keyfile_get_boolean_with_default (ostree_repo_get_config (repo), "core", + "commit-update-summary", FALSE, + &commit_update_summary, error)) + goto out; + + if (commit_update_summary && !ostree_repo_regenerate_summary (repo, + NULL, + cancellable, + error)) + goto out; + } } else { |