GNU bug report logs - #40367
[PATCH] lint: Display result of checkers on stdout.

Previous Next

Package: guix-patches;

Reported by: Brice Waegeneire <brice <at> waegenei.re>

Date: Wed, 1 Apr 2020 07:40:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 40367 in the body.
You can then email your comments to 40367 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Wed, 01 Apr 2020 07:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Brice Waegeneire <brice <at> waegenei.re>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 01 Apr 2020 07:40:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: guix-patches <at> gnu.org
Subject: [PATCH] lint: Display result of checkers on stdout.
Date: Wed,  1 Apr 2020 09:38:35 +0200
* guix/scripts/lint.scm (run-checkers): Replace 'current-error-port' by
'current-output-port'.
---
 guix/scripts/lint.scm | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 8d08c484f5..87705ef6d5 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune <at> gmail.com>
+;;; Copyright © 2020 Brice Waegeneire <brice <at> waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,19 +56,21 @@
 
 (define (run-checkers package checkers)
   "Run the given CHECKERS on PACKAGE."
-  (let ((tty? (isatty? (current-error-port))))
-    (for-each (lambda (checker)
-                (when tty?
-                  (format (current-error-port) "checking ~a@~a [~a]...\x1b[K\r"
-                          (package-name package) (package-version package)
-                          (lint-checker-name checker))
-                  (force-output (current-error-port)))
-                (emit-warnings
-                 ((lint-checker-check checker) package)))
-              checkers)
-    (when tty?
-      (format (current-error-port) "\x1b[K")
-      (force-output (current-error-port)))))
+  (parameterize
+   ((guix-warning-port (current-output-port)))
+   (let ((tty? (isatty? (current-output-port))))
+     (for-each (lambda (checker)
+                 (when tty?
+                   (format #t "checking ~a@~a [~a]...\x1b[K\r"
+                           (package-name package) (package-version package)
+                           (lint-checker-name checker))
+                   (force-output))
+                 (emit-warnings
+                  ((lint-checker-check checker) package)))
+               checkers)
+     (when tty?
+       (format #t "\x1b[K")
+       (force-output)))))
 
 (define (list-checkers-and-exit checkers)
   ;; Print information about all available checkers and exit.
-- 
2.25.1





Information forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Wed, 01 Apr 2020 12:26:02 GMT) Full text and rfc822 format available.

Message #8 received at 40367 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 40367 <at> debbugs.gnu.org
Subject: Re: [bug#40367] [PATCH] lint: Display result of checkers on stdout.
Date: Wed, 01 Apr 2020 14:25:52 +0200
[Message part 1 (text/plain, inline)]
Brice,

Thanks!  As discussed on IRC, I agree stdout is better.  These are 
reports, not run-time errors.

Brice Waegeneire 写道:
> * guix/scripts/lint.scm (run-checkers): Replace 
> 'current-error-port' by
> 'current-output-port'.

It should still print *progress* messages (and any run-time 
warnings & errors) to stderr, though:

 $ guix lint sl >toot
 checking sl <at> 5.02[cve]...

 $ guix lint sl >toot
 guix lint: error: something bad happened

This includes reverting to (isatty? (current-error-port)); 
stdout's ttyness doesn't matter.

Please also rebase your revisions onto current master 
(particularly 57e12aa).

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Wed, 01 Apr 2020 13:20:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: guix-patches <at> gnu.org
Subject: [PATCH v2] lint: Display result of checkers on stdout.
Date: Wed,  1 Apr 2020 15:19:25 +0200
* guix/scripts/lint.scm (emit-warnings): Use 'current-output-port'
instead of 'current-error-port'.
---

This version is rebased on top of master and only change the output port to
stdout for the result of the checkers, not for the progress or any run-time
errors.

 guix/scripts/lint.scm | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 97ffd57301..28b4db656c 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune <at> gmail.com>
+;;; Copyright © 2020 Brice Waegeneire <brice <at> waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,13 +47,17 @@
   ;; given, the location of PACKAGE otherwise, the full name of PACKAGE and the
   ;; provided MESSAGE.
   (for-each
-   (lambda (lint-warning)
-     (let ((package (lint-warning-package lint-warning))
-           (loc     (lint-warning-location lint-warning)))
-       (info loc (G_ "~a@~a: ~a~%")
-             (package-name package) (package-version package)
-             (lint-warning-message lint-warning))))
-   warnings))
+     (lambda (lint-warning)
+       (let* ((package (lint-warning-package lint-warning))
+              (name (package-name package))
+              (version (package-version package))
+              (loc     (lint-warning-location lint-warning))
+              (message (lint-warning-message lint-warning)))
+         (parameterize
+             ((guix-warning-port (current-output-port)))
+            (info loc (G_ "~a@~a: ~a~%")
+                  name version message) )))
+     warnings))
 
 (define* (run-checkers package checkers #:key store)
   "Run the given CHECKERS on PACKAGE."
-- 
2.25.1





Information forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Wed, 01 Apr 2020 13:22:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>, Tobias Geerinckx-Rice via
 Guix-patches <guix-patches <at> gnu.org>
Cc: 40367 <at> debbugs.gnu.org,
 Guix-patches <guix-patches-bounces+brice+lists=waegenei.re <at> gnu.org>
Subject: Re: [bug#40367] [PATCH] lint: Display result of checkers on stdout.
Date: Wed, 01 Apr 2020 13:21:37 +0000
Hello Tobias,

On 2020-04-01 12:25, Tobias Geerinckx-Rice via Guix-patches via wrote:
> It should still print *progress* messages (and any run-time warnings &
> errors) to stderr, though:
> 
>  $ guix lint sl >toot
>  checking sl <at> 5.02[cve]...
> 
>  $ guix lint sl >toot
>  guix lint: error: something bad happened
> 
> This includes reverting to (isatty? (current-error-port)); stdout's
> ttyness doesn't matter.
> 
> Please also rebase your revisions onto current master (particularly 
> 57e12aa).

I have take into account all of your suggestions in v2.

Thanks for the review,
- Brice




Information forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Wed, 01 Apr 2020 13:22:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Tue, 21 Apr 2020 09:00:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>, Tobias Geerinckx-Rice via
 Guix-patches <guix-patches <at> gnu.org>
Cc: 40367 <at> debbugs.gnu.org,
 Guix-patches <guix-patches-bounces+brice+lists=waegenei.re <at> gnu.org>
Subject: Re: [bug#40367] [PATCH] lint: Display result of checkers on stdout.
Date: Tue, 21 Apr 2020 08:58:56 +0000
Ping?




Information forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Tue, 21 Apr 2020 09:00:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#40367; Package guix-patches. (Thu, 21 May 2020 19:10:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: guix-patches <at> gnu.org
Subject: [PATCH v3] lint: Display result of checkers on stdout.
Date: Thu, 21 May 2020 21:08:38 +0200
* guix/scripts/lint.scm (emit-warnings): Use 'current-output-port'
instead of 'current-error-port'.
---

This version remove an extra space and correctly indent the patch.

 guix/scripts/lint.scm | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 97ffd57301..5445645b53 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune <at> gmail.com>
+;;; Copyright © 2020 Brice Waegeneire <brice <at> waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,11 +48,15 @@
   ;; provided MESSAGE.
   (for-each
    (lambda (lint-warning)
-     (let ((package (lint-warning-package lint-warning))
-           (loc     (lint-warning-location lint-warning)))
-       (info loc (G_ "~a@~a: ~a~%")
-             (package-name package) (package-version package)
-             (lint-warning-message lint-warning))))
+     (let* ((package (lint-warning-package lint-warning))
+            (name    (package-name package))
+            (version (package-version package))
+            (loc     (lint-warning-location lint-warning))
+            (message (lint-warning-message lint-warning)))
+       (parameterize
+           ((guix-warning-port (current-output-port)))
+         (info loc (G_ "~a@~a: ~a~%")
+               name version message))))
    warnings))
 
 (define* (run-checkers package checkers #:key store)
-- 
2.26.2





Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Sat, 21 Nov 2020 10:25:02 GMT) Full text and rfc822 format available.

Notification sent to Brice Waegeneire <brice <at> waegenei.re>:
bug acknowledged by developer. (Sat, 21 Nov 2020 10:25:02 GMT) Full text and rfc822 format available.

Message #31 received at 40367-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Brice Waegeneire <brice <at> waegenei.re>
Cc: 40367-done <at> debbugs.gnu.org
Subject: Re: [bug#40367] [PATCH v3] lint: Display result of checkers on stdout.
Date: Sat, 21 Nov 2020 10:24:36 +0000
[Message part 1 (text/plain, inline)]
Brice Waegeneire <brice <at> waegenei.re> writes:

> * guix/scripts/lint.scm (emit-warnings): Use 'current-output-port'
> instead of 'current-error-port'.
> ---
>
> This version remove an extra space and correctly indent the patch.
>
>  guix/scripts/lint.scm | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
> index 97ffd57301..5445645b53 100644
> --- a/guix/scripts/lint.scm
> +++ b/guix/scripts/lint.scm
> @@ -10,6 +10,7 @@
>  ;;; Copyright © 2017, 2018 Efraim Flashner <efraim <at> flashner.co.il>
>  ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac <at> systemreboot.net>
>  ;;; Copyright © 2019 Simon Tournier <zimon.toutoune <at> gmail.com>
> +;;; Copyright © 2020 Brice Waegeneire <brice <at> waegenei.re>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -47,11 +48,15 @@
>    ;; provided MESSAGE.
>    (for-each
>     (lambda (lint-warning)
> -     (let ((package (lint-warning-package lint-warning))
> -           (loc     (lint-warning-location lint-warning)))
> -       (info loc (G_ "~a@~a: ~a~%")
> -             (package-name package) (package-version package)
> -             (lint-warning-message lint-warning))))
> +     (let* ((package (lint-warning-package lint-warning))
> +            (name    (package-name package))
> +            (version (package-version package))
> +            (loc     (lint-warning-location lint-warning))
> +            (message (lint-warning-message lint-warning)))
> +       (parameterize
> +           ((guix-warning-port (current-output-port)))
> +         (info loc (G_ "~a@~a: ~a~%")
> +               name version message))))
>     warnings))
>  
>  (define* (run-checkers package checkers #:key store)

Thanks, and apologies in the delay in looking at this again.

I've pushed it to master as becfa42ea79feb402fe6bc5922da2019ef021e88.q

Thanks again,

Chris
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 19 Dec 2020 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 129 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.