diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2015-04-13 20:26:21 -0400 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2015-04-16 18:13:08 -0400 |
commit | d7a6f257a0bb214e38a207554da2c7aefe8f905c (patch) | |
tree | 57e2592dc610dc0abf51ea729ba5266897432ddc /src/ostree/ot-builtin-pull.c | |
parent | 20076ff201a899e0f2b7d06bc83a5812b7091660 (diff) | |
download | ostree-d7a6f257a0bb214e38a207554da2c7aefe8f905c.tar.gz |
pull: Print GPG signature status as soon as its known
Diffstat (limited to 'src/ostree/ot-builtin-pull.c')
-rw-r--r-- | src/ostree/ot-builtin-pull.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c index 91db17d1..5d9eac42 100644 --- a/src/ostree/ot-builtin-pull.c +++ b/src/ostree/ot-builtin-pull.c @@ -40,6 +40,20 @@ static int opt_depth = 0; { NULL } }; +static void +gpg_verify_result_cb (OstreeRepo *repo, + const char *checksum, + OstreeGpgVerifyResult *result, + GSConsole *console) +{ + /* Temporarily place the GSConsole stream (which is just stdout) + * back in normal mode before printing GPG verification results. */ + gs_console_end_status_line (console, NULL, NULL); + + g_print ("\n"); + ostree_print_gpg_verify_result (result); +} + gboolean ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **error) { @@ -51,6 +65,7 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError ** GSConsole *console = NULL; gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL; gs_unref_object OstreeAsyncProgress *progress = NULL; + gulong signal_handler_id = 0; context = g_option_context_new ("REMOTE [BRANCH...] - Download data from remote repository"); @@ -100,6 +115,9 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError ** { gs_console_begin_status_line (console, "", NULL, NULL); progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, console); + signal_handler_id = g_signal_connect (repo, "gpg-verify-result", + G_CALLBACK (gpg_verify_result_cb), + console); } { @@ -116,7 +134,7 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError ** g_variant_new_variant (g_variant_new_strv ((const char *const*) refs_to_fetch->pdata, -1))); g_variant_builder_add (&builder, "{s@v}", "depth", g_variant_new_variant (g_variant_new_int32 (opt_depth))); - + if (!ostree_repo_pull_with_options (repo, remote, g_variant_builder_end (&builder), progress, cancellable, error)) goto out; @@ -127,6 +145,9 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError ** ret = TRUE; out: + if (signal_handler_id > 0) + g_signal_handler_disconnect (repo, signal_handler_id); + if (console) gs_console_end_status_line (console, NULL, NULL); |