From d1078f579eeba3bc9faf4e49c9e4c5da2f9d1085 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 29 Sep 2016 11:59:58 +0200 Subject: ostree: Print pull progress also when not on console Change-Id: I3944166b61d120f19e31f84abcf26e91a2f8cfb8 Upstream-status: Pending Reviewed-by: Samuli Piippo --- recipes/ostree/ostree.bb | 1 + ...nt-pull-progress-also-when-not-on-console.patch | 94 ++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 recipes/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch diff --git a/recipes/ostree/ostree.bb b/recipes/ostree/ostree.bb index 75d5bd5..37af99d 100644 --- a/recipes/ostree/ostree.bb +++ b/recipes/ostree/ostree.bb @@ -43,6 +43,7 @@ SRC_URI = " \ file://Allow-updating-files-in-the-boot-directory.patch \ file://u-boot-add-bootdir-to-the-generated-uEnv.txt.patch \ file://Create-firmware-convenience-symlinks.patch \ + file://Print-pull-progress-also-when-not-on-console.patch \ " SRCREV = "8ece4d6d51bdbe3e41ab318259276bb83e553aa0" diff --git a/recipes/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch b/recipes/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch new file mode 100644 index 0000000..f8e7324 --- /dev/null +++ b/recipes/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch @@ -0,0 +1,94 @@ +From b24d691d968bca608142882b453e98ed5ee267e9 Mon Sep 17 00:00:00 2001 +From: Gatis Paeglis +Date: Thu, 29 Sep 2016 11:46:59 +0200 +Subject: [PATCH] Print pull progress also when not on console + +glnx_console_text is smart enough: + +"On a tty, print to the console @text followed by an ASCII art + progress bar whose percentage is @percentage. If stdout is not a + tty, a more basic line by line change will be printed." + +Otherwise, when pulling a lot of data, we do not get any feedback +in a GUI application for a significant amount of time. +--- + src/ostree/ot-admin-builtin-switch.c | 3 +-- + src/ostree/ot-admin-builtin-upgrade.c | 3 +-- + src/ostree/ot-builtin-pull-local.c | 3 +-- + src/ostree/ot-builtin-pull.c | 12 ++++-------- + 4 files changed, 7 insertions(+), 14 deletions(-) + +diff --git a/src/ostree/ot-admin-builtin-switch.c b/src/ostree/ot-admin-builtin-switch.c +index 895538a..7f1d6dd 100644 +--- a/src/ostree/ot-admin-builtin-switch.c ++++ b/src/ostree/ot-admin-builtin-switch.c +@@ -126,8 +126,7 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro + { g_auto(GLnxConsoleRef) console = { 0, }; + glnx_console_lock (&console); + +- if (console.is_tty) +- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); ++ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); + + /* Always allow older...there's not going to be a chronological + * relationship necessarily. +diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c +index 81f9bb6..8147b4f 100644 +--- a/src/ostree/ot-admin-builtin-upgrade.c ++++ b/src/ostree/ot-admin-builtin-upgrade.c +@@ -109,8 +109,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr + { g_auto(GLnxConsoleRef) console = { 0, }; + glnx_console_lock (&console); + +- if (console.is_tty) +- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); ++ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); + + if (opt_allow_downgrade) + upgraderpullflags |= OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER; +diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c +index 5401a28..f2f5b21 100644 +--- a/src/ostree/ot-builtin-pull-local.c ++++ b/src/ostree/ot-builtin-pull-local.c +@@ -159,8 +159,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr + g_variant_builder_add (&builder, "{s@v}", "depth", + g_variant_new_variant (g_variant_new_int32 (opt_depth))); + +- if (console.is_tty) +- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); ++ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); + + opts = g_variant_ref_sink (g_variant_builder_end (&builder)); + if (!ostree_repo_pull_with_options (repo, src_repo_uri, +diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c +index 99b2593..78686b3 100644 +--- a/src/ostree/ot-builtin-pull.c ++++ b/src/ostree/ot-builtin-pull.c +@@ -242,20 +242,16 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError ** + + if (!opt_dry_run) + { +- if (console.is_tty) +- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); ++ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console); + } + else + { + progress = ostree_async_progress_new_and_connect (dry_run_console_progress_changed, NULL); + } + +- if (console.is_tty) +- { +- signal_handler_id = g_signal_connect (repo, "gpg-verify-result", +- G_CALLBACK (gpg_verify_result_cb), +- &console); +- } ++ signal_handler_id = g_signal_connect (repo, "gpg-verify-result", ++ G_CALLBACK (gpg_verify_result_cb), ++ &console); + + if (!ostree_repo_pull_with_options (repo, remote, g_variant_builder_end (&builder), + progress, cancellable, error)) +-- +2.7.4 + -- cgit v1.2.3-54-g00ecf