From patchwork Wed Mar 9 10:12:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 37696 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 8F68C27BBEA; Wed, 9 Mar 2022 10:13:34 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 477D127BBE9 for ; Wed, 9 Mar 2022 10:13:34 +0000 (GMT) Received: from localhost ([::1]:36976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRtK1-0002sN-CB for patchwork@mira.cbaines.net; Wed, 09 Mar 2022 05:13:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRtJX-0002oU-Oa for guix-patches@gnu.org; Wed, 09 Mar 2022 05:13:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:36474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRtJW-0004oN-GS for guix-patches@gnu.org; Wed, 09 Mar 2022 05:13:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nRtJW-0003JY-CP for guix-patches@gnu.org; Wed, 09 Mar 2022 05:13:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built". References: <20220309095710.23849-1-ludo@gnu.org> In-Reply-To: <20220309095710.23849-1-ludo@gnu.org> Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Mar 2022 10:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54307@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 54307-submit@debbugs.gnu.org id=B54307.164682077912717 (code B ref 54307); Wed, 09 Mar 2022 10:13:02 +0000 Received: (at 54307) by debbugs.gnu.org; 9 Mar 2022 10:12:59 +0000 Received: from localhost ([127.0.0.1]:58602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRtJS-0003Iy-P6 for submit@debbugs.gnu.org; Wed, 09 Mar 2022 05:12:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRtJR-0003Ib-Ab for 54307@debbugs.gnu.org; Wed, 09 Mar 2022 05:12:57 -0500 Received: from [2001:470:142:3::e] (port=32932 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRtJE-0004m4-Jn; Wed, 09 Mar 2022 05:12:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=zLKmOcRNgq0GU66wHrUunL3zB81/QytRUfVTX/Y5AbI=; b=C5dUoJPBTqa4Se CoB9QPK+f1Zi+F7hmb48vEFfjUqUc4O4A9hqcEX3o2HX+5PKBVtNFbOT1weNysxzPA5a8xmwR4IMF NJnJty0eFQALHF/AJgRE7VP31JX04Y/RsHL+azrmjKzK9D3XiFh00N9TDQgwFNnUYQz1RbkmdSgXU tyKJbdn6Ql8KbxLQorIVmwynaOKewJgqc+lPRoAYWEiOyH/YQ0cffxRDZp7e6aeWW3IKxrec3TfG0 5uosHDpSNe+cyjtLEcVZh7wRUTbjpCj2xi1/a9fUtXiFHcsYaM4yfuJ+KFS4K+EmwgP6tDS9+Kgk8 1kh5ehohYUaOsImUMBVQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52476 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRtJ9-0002ig-SU; Wed, 09 Mar 2022 05:12:41 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 9 Mar 2022 11:12:33 +0100 Message-Id: <20220309101234.24236-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 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 * guix/colors.scm (highlight/warn): New procedure. * guix/ui.scm (show-what-to-build): Use 'highlight/warn' when displaying what would/will be built. --- guix/colors.scm | 4 +++- guix/ui.scm | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/guix/colors.scm b/guix/colors.scm index 3031f54799..ae0a583d94 100644 --- a/guix/colors.scm +++ b/guix/colors.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2013, 2014 Free Software Foundation, Inc. ;;; Copyright © 2018 Sahithi Yarlagadda ;;; Copyright © 2018 Ricardo Wurmus -;;; Copyright © 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2017, 2018, 2019, 2022 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,6 +31,7 @@ (define-module (guix colors) colorize-string highlight + highlight/warn dim color-rules @@ -143,6 +144,7 @@ (define (coloring-procedure color) str))) (define highlight (coloring-procedure (color BOLD))) +(define highlight/warn (coloring-procedure (color BOLD MAGENTA))) (define dim (coloring-procedure (color DARK))) (define (colorize-matches rules) diff --git a/guix/ui.scm b/guix/ui.scm index 238952723e..8e4e3e2dfc 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1031,12 +1031,14 @@ (define display-download-size? ;; Unfortunately, this is hardly avoidable for proper i18n. (if dry-run? (begin - (unless (zero? verbosity) + (unless (or (zero? verbosity) (null? build)) (format (current-error-port) - (N_ "~:[The following derivation would be built:~%~{ ~a~%~}~;~]" - "~:[The following derivations would be built:~%~{ ~a~%~}~;~]" - (length build)) - (null? build) (map colorized-store-item build))) + (highlight/warn + (N_ "The following derivation would be built:~%" + "The following derivations would be built:~%" + (length build)))) + (format (current-error-port) "~{ ~a~%~}" + (map colorized-store-item build))) (cond ((>= verbosity 2) (if display-download-size? (format (current-error-port) @@ -1082,12 +1084,14 @@ (define display-download-size? (null? download) (length download)))))) (begin - (unless (zero? verbosity) + (unless (or (zero? verbosity) (null? build)) (format (current-error-port) - (N_ "~:[The following derivation will be built:~%~{ ~a~%~}~;~]" - "~:[The following derivations will be built:~%~{ ~a~%~}~;~]" - (length build)) - (null? build) (map colorized-store-item build))) + (highlight/warn + (N_ "The following derivation will be built:~%" + "The following derivations will be built:~%" + (length build)))) + (format (current-error-port) "~{ ~a~%~}" + (map colorized-store-item build))) (cond ((>= verbosity 2) (if display-download-size? (format (current-error-port) From patchwork Wed Mar 9 10:12:34 2022 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: 37697 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 1CD9027BBEA; Wed, 9 Mar 2022 10:13:35 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 985E127BBE9 for ; Wed, 9 Mar 2022 10:13:34 +0000 (GMT) Received: from localhost ([::1]:37004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRtK1-0002t6-N5 for patchwork@mira.cbaines.net; Wed, 09 Mar 2022 05:13:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRtJW-0002oO-LB for guix-patches@gnu.org; Wed, 09 Mar 2022 05:13:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:36473) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRtJW-0004oD-BF for guix-patches@gnu.org; Wed, 09 Mar 2022 05:13:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nRtJW-0003JR-0y for guix-patches@gnu.org; Wed, 09 Mar 2022 05:13:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54307] [PATCH 2/2] ui: 'show-what-to-build' highlights "would be downloaded" headings. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Mar 2022 10:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54307 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54307@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 54307-submit@debbugs.gnu.org id=B54307.164682077812711 (code B ref 54307); Wed, 09 Mar 2022 10:13:01 +0000 Received: (at 54307) by debbugs.gnu.org; 9 Mar 2022 10:12:58 +0000 Received: from localhost ([127.0.0.1]:58600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRtJS-0003Iu-D9 for submit@debbugs.gnu.org; Wed, 09 Mar 2022 05:12:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRtJQ-0003IZ-Ua for 54307@debbugs.gnu.org; Wed, 09 Mar 2022 05:12:57 -0500 Received: from [2001:470:142:3::e] (port=32936 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRtJG-0004m5-0I; Wed, 09 Mar 2022 05:12:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=U6C2aisN+Ks3fFBlQfyCGHmpRXc+AmhnMajhgo/Q3bA=; b=T/yTVguf3Rp1aCkJKCEO zjUou6P2EB0+DpXWxf0QJ/sFvTPg+MmQZ9L0yGu6+FqjcZv2IyHKp2bFK3Xrmmen9p8AYe3yecz7C qRESuCtB1DOWlFAk83X2eVkKdk8n29JcVL+O+MifKWlEwt+jr+S3pc4i2GDNzfjaAsHfc/x/wrkoh OtYjypLU5PCBfrLdPl3YbYxYg028GcykTL3HZtPgausgo2YwBK4aAJniFk0sWsWR/8WoZAH3p2XdI 1vgwxl9tVThdCfW7p+qUAa9yhOIx7IQDi7DsgHn3ivU3XCwyx/yA1KqL5yo0vAgvAwvNjqNvyIqg1 U/h5t0KSi5r2Cw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52476 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRtJE-0002ig-PZ; Wed, 09 Mar 2022 05:12:44 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 9 Mar 2022 11:12:34 +0100 Message-Id: <20220309101234.24236-2-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220309101234.24236-1-ludo@gnu.org> References: <20220309101234.24236-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 * guix/ui.scm (show-what-to-build): Highlight "X MB would be downloaded". --- guix/ui.scm | 74 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index 8e4e3e2dfc..6c194eb3c9 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1041,21 +1041,28 @@ (define display-download-size? (map colorized-store-item build))) (cond ((>= verbosity 2) (if display-download-size? - (format (current-error-port) - ;; TRANSLATORS: "MB" is for "megabyte"; it should be - ;; translated to the corresponding abbreviation. - (G_ "~:[~,1h MB would be downloaded:~%~{ ~a~%~}~;~]") - (null? download) - download-size - (map (compose colorized-store-item substitutable-path) - download)) - (format (current-error-port) - (N_ "~:[The following file would be downloaded:~%~{ ~a~%~}~;~]" - "~:[The following files would be downloaded:~%~{ ~a~%~}~;~]" - (length download)) - (null? download) - (map (compose colorized-store-item substitutable-path) - download))) + (begin + (format (current-error-port) + (highlight + ;; TRANSLATORS: "MB" is for "megabyte"; it + ;; should be translated to the corresponding + ;; abbreviation. + (G_ "~:[~,1h MB would be downloaded:~%~;~]")) + (null? download) + download-size) + (format (current-error-port) "~{ ~a~%~}" + (map (compose colorized-store-item substitutable-path) + download))) + (begin + (format (current-error-port) + (highlight + (N_ "~:[The following file would be downloaded:~%~;~]" + "~:[The following files would be downloaded:~%~;~]" + (length download))) + (null? download)) + (format (current-error-port) "~{ ~a~%~}" + (map (compose colorized-store-item substitutable-path) + download)))) (format (current-error-port) (N_ "~:[The following graft would be made:~%~{ ~a~%~}~;~]" "~:[The following grafts would be made:~%~{ ~a~%~}~;~]" @@ -1094,21 +1101,28 @@ (define display-download-size? (map colorized-store-item build))) (cond ((>= verbosity 2) (if display-download-size? - (format (current-error-port) - ;; TRANSLATORS: "MB" is for "megabyte"; it should be - ;; translated to the corresponding abbreviation. - (G_ "~:[~,1h MB will be downloaded:~%~{ ~a~%~}~;~]") - (null? download) - download-size - (map (compose colorized-store-item substitutable-path) - download)) - (format (current-error-port) - (N_ "~:[The following file will be downloaded:~%~{ ~a~%~}~;~]" - "~:[The following files will be downloaded:~%~{ ~a~%~}~;~]" - (length download)) - (null? download) - (map (compose colorized-store-item substitutable-path) - download))) + (begin + (format (current-error-port) + (highlight + ;; TRANSLATORS: "MB" is for "megabyte"; it + ;; should be translated to the corresponding + ;; abbreviation. + (G_ "~:[~,1h MB will be downloaded:~%~;~]")) + (null? download) + download-size) + (format (current-error-port) "~{ ~a~%~}" + (map (compose colorized-store-item substitutable-path) + download))) + (begin + (format (current-error-port) + (highlight + (N_ "~:[The following file will be downloaded:~%~;~]" + "~:[The following files will be downloaded:~%~;~]" + (length download))) + (null? download)) + (format (current-error-port) "~{ ~a~%~}" + (map (compose colorized-store-item substitutable-path) + download)))) (format (current-error-port) (N_ "~:[The following graft will be made:~%~{ ~a~%~}~;~]" "~:[The following grafts will be made:~%~{ ~a~%~}~;~]"