diff options
author | Alexander Larsson <alexl@redhat.com> | 2020-09-01 12:28:17 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2020-10-23 12:30:08 +0200 |
commit | 625606a7eccffd246b359a12215f1b5bad22b702 (patch) | |
tree | c687b47cf8c2e6b1e152492e0da5c29acd3737c6 /src/ostree | |
parent | c304703e1d88265f1fd76744b1abaa2ddf415a9e (diff) | |
download | ostree-625606a7eccffd246b359a12215f1b5bad22b702.tar.gz |
deltas: Add CLI ops to list and reindex delta-indexes
Diffstat (limited to 'src/ostree')
-rw-r--r-- | src/ostree/ot-builtin-static-delta.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/ostree/ot-builtin-static-delta.c b/src/ostree/ot-builtin-static-delta.c index 3e0af5bd..ff31b574 100644 --- a/src/ostree/ot-builtin-static-delta.c +++ b/src/ostree/ot-builtin-static-delta.c @@ -53,6 +53,8 @@ BUILTINPROTO(delete); BUILTINPROTO(generate); BUILTINPROTO(apply_offline); BUILTINPROTO(verify); +BUILTINPROTO(indexes); +BUILTINPROTO(reindex); #undef BUILTINPROTO @@ -75,6 +77,12 @@ static OstreeCommand static_delta_subcommands[] = { { "verify", OSTREE_BUILTIN_FLAG_NONE, ot_static_delta_builtin_verify, "Verify static delta signatures" }, + { "indexes", OSTREE_BUILTIN_FLAG_NONE, + ot_static_delta_builtin_indexes, + "List static delta indexes" }, + { "reindex", OSTREE_BUILTIN_FLAG_NONE, + ot_static_delta_builtin_reindex, + "Regenerate static delta indexes" }, { NULL, 0, NULL, NULL } }; @@ -126,6 +134,15 @@ static GOptionEntry verify_options[] = { { NULL } }; +static GOptionEntry indexes_options[] = { + { NULL } +}; + +static GOptionEntry reindex_options[] = { + { "to", 0, 0, G_OPTION_ARG_STRING, &opt_to_rev, "Only update delta index to revision REV", "REV" }, + { NULL } +}; + static void static_delta_usage (char **argv, gboolean is_error) @@ -177,6 +194,46 @@ ot_static_delta_builtin_list (int argc, char **argv, OstreeCommandInvocation *in } static gboolean +ot_static_delta_builtin_indexes (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) +{ + g_autoptr(OstreeRepo) repo = NULL; + g_autoptr(GOptionContext) context = g_option_context_new (""); + if (!ostree_option_context_parse (context, indexes_options, &argc, &argv, + invocation, &repo, cancellable, error)) + return FALSE; + + g_autoptr(GPtrArray) indexes = NULL; + if (!ostree_repo_list_static_delta_indexes (repo, &indexes, cancellable, error)) + return FALSE; + + if (indexes->len == 0) + g_print ("(No static deltas indexes)\n"); + else + { + for (guint i = 0; i < indexes->len; i++) + g_print ("%s\n", (char*)indexes->pdata[i]); + } + + return TRUE; +} + +static gboolean +ot_static_delta_builtin_reindex (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) +{ + g_autoptr(GOptionContext) context = g_option_context_new (""); + + g_autoptr(OstreeRepo) repo = NULL; + if (!ostree_option_context_parse (context, reindex_options, &argc, &argv, invocation, &repo, cancellable, error)) + return FALSE; + + if (!ostree_repo_static_delta_reindex (repo, 0, opt_to_rev, cancellable, error)) + return FALSE; + + return TRUE; +} + + +static gboolean ot_static_delta_builtin_show (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { |