From patchwork Sun Mar 21 16:56:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 28002 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2DEE227BC58; Sun, 21 Mar 2021 17:01:07 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D585527BC5D for ; Sun, 21 Mar 2021 16:58:54 +0000 (GMT) Received: from localhost ([::1]:57580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lO1O6-000234-Gi for patchwork@mira.cbaines.net; Sun, 21 Mar 2021 12:57:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lO1Nu-00022M-G5 for guix-patches@gnu.org; Sun, 21 Mar 2021 12:57:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lO1Nu-0004UI-9B for guix-patches@gnu.org; Sun, 21 Mar 2021 12:57:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lO1Nu-0008IU-9A for guix-patches@gnu.org; Sun, 21 Mar 2021 12:57:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47295] [PATCH 2/2] status: Don't display download URLs for '--verbosity=1'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 21 Mar 2021 16:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47295 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47295@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 47295-submit@debbugs.gnu.org id=B47295.161634579931856 (code B ref 47295); Sun, 21 Mar 2021 16:57:02 +0000 Received: (at 47295) by debbugs.gnu.org; 21 Mar 2021 16:56:39 +0000 Received: from localhost ([127.0.0.1]:55347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lO1NW-0008Hk-Q1 for submit@debbugs.gnu.org; Sun, 21 Mar 2021 12:56:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lO1NV-0008HQ-5p for 47295@debbugs.gnu.org; Sun, 21 Mar 2021 12:56:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41983) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lO1NP-0004Hu-Il; Sun, 21 Mar 2021 12:56:31 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=38628 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lO1NF-0005cv-6c; Sun, 21 Mar 2021 12:56:24 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 21 Mar 2021 17:56:04 +0100 Message-Id: <20210321165604.6426-2-ludo@gnu.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210321165604.6426-1-ludo@gnu.org> References: <20210321165604.6426-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches With this change, each substitute occupies a single line of output (instead of two) when using '-v1', the default for 'guix package' & co. * guix/status.scm (print-build-event): Add #:print-urls? and honor it. (print-build-event/quiet): Pass #:print-urls? #f. (print-build-event/quiet-with-urls): New procedure. (logger-for-level): Add case for LEVEL 2. * doc/guix.texi (Common Build Options): Adjust '--verbosity' documentation. --- doc/guix.texi | 7 ++++--- guix/status.scm | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 94ecd2c247..8c6550e733 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10253,9 +10253,10 @@ guix-daemon, @option{--timeout}}). @cindex build logs, verbosity @item -v @var{level} @itemx --verbosity=@var{level} -Use the given verbosity @var{level}, an integer. Choosing 0 means that no -output is produced, 1 is for quiet output, and 2 shows all the build log -output on standard error. +Use the given verbosity @var{level}, an integer. Choosing 0 means that +no output is produced, 1 is for quiet output; 2 is similar to 1 but it +additionally displays download URLs; 3 shows all the build log output on +standard error. @item --cores=@var{n} @itemx -c @var{n} diff --git a/guix/status.scm b/guix/status.scm index d47bf1700c..362ae2882c 100644 --- a/guix/status.scm +++ b/guix/status.scm @@ -403,10 +403,12 @@ the current build phase." #:optional (port (current-error-port)) #:key (colorize? (color-output? port)) + (print-urls? #t) (print-log? #t)) "Print information about EVENT and STATUS to PORT. When COLORIZE? is true, produce colorful output. When PRINT-LOG? is true, display the build log in -addition to build events." +addition to build events. When PRINT-URLS? is true, display the URL of +substitutes being downloaded." (define info (if colorize? (cute colorize-string <> (color BOLD)) @@ -526,9 +528,10 @@ addition to build events." (format port (info (G_ "substituting ~a...")) item) (newline port))) (('download-started item uri _ ...) - (erase-current-line*) - (format port (info (G_ "downloading from ~a ...")) uri) - (newline port)) + (when print-urls? + (erase-current-line*) + (format port (info (G_ "downloading from ~a ...")) uri) + (newline port))) (('download-progress item uri (= string->number size) (= string->number transferred)) @@ -602,6 +605,17 @@ addition to build events." (colorize? (color-output? port))) (print-build-event event old-status status port #:colorize? colorize? + #:print-urls? #f + #:print-log? #f)) + +(define* (print-build-event/quiet-with-urls event old-status status + #:optional + (port (current-error-port)) + #:key + (colorize? (color-output? port))) + (print-build-event event old-status status port + #:colorize? colorize? + #:print-urls? #t ;show download URLs #:print-log? #f)) (define* (build-status-updater #:optional (on-change (const #t))) @@ -787,6 +801,7 @@ evaluate EXP... in that context." "Return the logging procedure that corresponds to LEVEL." (cond ((<= level 0) (const #t)) ((= level 1) print-build-event/quiet) + ((= level 2) print-build-event/quiet-with-urls) (else print-build-event))) (define (call-with-status-verbosity level thunk)