* [bug#40367] [PATCH] lint: Display result of checkers on stdout.
@ 2020-04-01 7:38 Brice Waegeneire
2020-04-01 12:25 ` Tobias Geerinckx-Rice via Guix-patches via
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Brice Waegeneire @ 2020-04-01 7:38 UTC (permalink / raw)
To: 40367
* 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@flashner.co.il>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2020 Brice Waegeneire <brice@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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#40367] [PATCH] lint: Display result of checkers on stdout.
2020-04-01 7:38 [bug#40367] [PATCH] lint: Display result of checkers on stdout Brice Waegeneire
@ 2020-04-01 12:25 ` Tobias Geerinckx-Rice via Guix-patches via
2020-04-01 13:21 ` Brice Waegeneire
2020-04-21 8:58 ` Brice Waegeneire
2020-04-01 13:19 ` [bug#40367] [PATCH v2] " Brice Waegeneire
2020-05-21 19:08 ` [bug#40367] [PATCH v3] " Brice Waegeneire
2 siblings, 2 replies; 7+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-04-01 12:25 UTC (permalink / raw)
To: 40367
[-- Attachment #1: Type: text/plain, Size: 678 bytes --]
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@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#40367] [PATCH v2] lint: Display result of checkers on stdout.
2020-04-01 7:38 [bug#40367] [PATCH] lint: Display result of checkers on stdout Brice Waegeneire
2020-04-01 12:25 ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-04-01 13:19 ` Brice Waegeneire
2020-05-21 19:08 ` [bug#40367] [PATCH v3] " Brice Waegeneire
2 siblings, 0 replies; 7+ messages in thread
From: Brice Waegeneire @ 2020-04-01 13:19 UTC (permalink / raw)
To: 40367
* 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@flashner.co.il>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2020 Brice Waegeneire <brice@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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#40367] [PATCH v3] lint: Display result of checkers on stdout.
2020-04-01 7:38 [bug#40367] [PATCH] lint: Display result of checkers on stdout Brice Waegeneire
2020-04-01 12:25 ` Tobias Geerinckx-Rice via Guix-patches via
2020-04-01 13:19 ` [bug#40367] [PATCH v2] " Brice Waegeneire
@ 2020-05-21 19:08 ` Brice Waegeneire
2020-11-21 10:24 ` bug#40367: " Christopher Baines
2 siblings, 1 reply; 7+ messages in thread
From: Brice Waegeneire @ 2020-05-21 19:08 UTC (permalink / raw)
To: 40367
* 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@flashner.co.il>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2020 Brice Waegeneire <brice@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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#40367: [PATCH v3] lint: Display result of checkers on stdout.
2020-05-21 19:08 ` [bug#40367] [PATCH v3] " Brice Waegeneire
@ 2020-11-21 10:24 ` Christopher Baines
0 siblings, 0 replies; 7+ messages in thread
From: Christopher Baines @ 2020-11-21 10:24 UTC (permalink / raw)
To: Brice Waegeneire; +Cc: 40367-done
[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]
Brice Waegeneire <brice@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@flashner.co.il>
> ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
> ;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
> +;;; Copyright © 2020 Brice Waegeneire <brice@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-11-21 10:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-01 7:38 [bug#40367] [PATCH] lint: Display result of checkers on stdout Brice Waegeneire
2020-04-01 12:25 ` Tobias Geerinckx-Rice via Guix-patches via
2020-04-01 13:21 ` Brice Waegeneire
2020-04-21 8:58 ` Brice Waegeneire
2020-04-01 13:19 ` [bug#40367] [PATCH v2] " Brice Waegeneire
2020-05-21 19:08 ` [bug#40367] [PATCH v3] " Brice Waegeneire
2020-11-21 10:24 ` bug#40367: " Christopher Baines
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).