* bug#34884: guix describe fails with --format=json and --format=recutils @ 2019-03-16 10:12 Pierre Neidhardt 2019-03-16 14:11 ` Oleg Pykhalov 0 siblings, 1 reply; 6+ messages in thread From: Pierre Neidhardt @ 2019-03-16 10:12 UTC (permalink / raw) To: 34884 [-- Attachment #1: Type: text/plain, Size: 2065 bytes --] --8<---------------cut here---------------start------------->8--- > guix describe --format=json [{"name":"guix","url":"https://git.savannah.gnu.org/git/guix.git","commit":"77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4"}] Backtrace: 4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix") In guix/ui.scm: 1654:12 3 (run-guix-command _ . _) In ice-9/boot-9.scm: 829:9 2 (catch srfi-34 #<procedure 2ff58a0 at guix/ui.scm:624:2 ()> #<procedure 7f711b6c39b8 at guix/ui.scm:624:2 (key c)> _) 829:9 1 (catch system-error #<procedure 2ff5940 at guix/scripts/describe.scm:203:4 ()> #<procedure 7f711b6c39d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _) In guix/scripts/describe.scm: 83:5 0 (display-package-search-path json) guix/scripts/describe.scm:83:5: In procedure display-package-search-path: Throw to key `match-error' with args `("match" "no matching pattern" json)'. --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- > guix describe -f recutils name: guix url: https://git.savannah.gnu.org/git/guix.git commit: 77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4 Backtrace: 4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix") In guix/ui.scm: 1654:12 3 (run-guix-command _ . _) In ice-9/boot-9.scm: 829:9 2 (catch srfi-34 #<procedure 2ac1d20 at guix/ui.scm:624:2 ()> #<procedure 7fa6695719b8 at guix/ui.scm:624:2 (key c)> _) 829:9 1 (catch system-error #<procedure 2ac1dc0 at guix/scripts/describe.scm:203:4 ()> #<procedure 7fa6695719d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _) In guix/scripts/describe.scm: 83:5 0 (display-package-search-path recutils) guix/scripts/describe.scm:83:5: In procedure display-package-search-path: Throw to key `match-error' with args `("match" "no matching pattern" recutils)'. --8<---------------cut here---------------end--------------->8--- -- Pierre Neidhardt https://ambrevar.xyz/ [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#34884: guix describe fails with --format=json and --format=recutils 2019-03-16 10:12 bug#34884: guix describe fails with --format=json and --format=recutils Pierre Neidhardt @ 2019-03-16 14:11 ` Oleg Pykhalov 2019-03-17 15:40 ` Ludovic Courtès 0 siblings, 1 reply; 6+ messages in thread From: Oleg Pykhalov @ 2019-03-16 14:11 UTC (permalink / raw) To: Pierre Neidhardt; +Cc: 34884 [-- Attachment #1.1: Type: text/plain, Size: 4186 bytes --] Hello Pierre, Good catch! I prepared a patch in the attachement bellow to fix this. Also the patch changes behavior of '--format=channels' for 'GUIX_PACKAGE_PATH' warning. It will print to STDERR instead of STDOUT. Pierre Neidhardt <mail@ambrevar.xyz> writes: >> guix describe --format=json > [{"name":"guix","url":"https://git.savannah.gnu.org/git/guix.git","commit":"77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4"}] > Backtrace: > 4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix") > In guix/ui.scm: > 1654:12 3 (run-guix-command _ . _) > In ice-9/boot-9.scm: > 829:9 2 (catch srfi-34 #<procedure 2ff58a0 at guix/ui.scm:624:2 ()> #<procedure 7f711b6c39b8 at guix/ui.scm:624:2 (key c)> _) > 829:9 1 (catch system-error #<procedure 2ff5940 at guix/scripts/describe.scm:203:4 ()> #<procedure 7f711b6c39d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _) > In guix/scripts/describe.scm: > 83:5 0 (display-package-search-path json) > > guix/scripts/describe.scm:83:5: In procedure display-package-search-path: > Throw to key `match-error' with args `("match" "no matching pattern" json)'. JSON format: --8<---------------cut here---------------start------------->8--- oleg@guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=json [{"name":"guix","url":"https://gitlab.wugi.info/guix/guix.git","commit":"4161deb4549c39b7d4801cc8aa63c365d19fc649"},{"name":"guix-wigust","url":"https://gitlab.wugi.info/guix/guix-wigust.git","commit":"f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0"}] {"name":"GUIX_PACKAGE_PATH","paths":["/home/oleg/src/guix-wigust","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist"]} --8<---------------cut here---------------end--------------->8--- >> guix describe -f recutils > name: guix > url: https://git.savannah.gnu.org/git/guix.git > commit: 77f3d3036406b1d1ceaeba8017ae5f597f2a0fb4 > > Backtrace: > 4 (primitive-load "/home/ambrevar/.config/guix/current/bin/guix") > In guix/ui.scm: > 1654:12 3 (run-guix-command _ . _) > In ice-9/boot-9.scm: > 829:9 2 (catch srfi-34 #<procedure 2ac1d20 at guix/ui.scm:624:2 ()> #<procedure 7fa6695719b8 at guix/ui.scm:624:2 (key c)> _) > 829:9 1 (catch system-error #<procedure 2ac1dc0 at guix/scripts/describe.scm:203:4 ()> #<procedure 7fa6695719d0 at guix/ui.scm:750:6 (key proc format-string format-args . rest)> _) > In guix/scripts/describe.scm: > 83:5 0 (display-package-search-path recutils) > > guix/scripts/describe.scm:83:5: In procedure display-package-search-path: > Throw to key `match-error' with args `("match" "no matching pattern" recutils)'. recutils format: --8<---------------cut here---------------start------------->8--- oleg@guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=recutils name: guix url: https://gitlab.wugi.info/guix/guix.git commit: 4161deb4549c39b7d4801cc8aa63c365d19fc649 name: guix-wigust url: https://gitlab.wugi.info/guix/guix-wigust.git commit: f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0 name: GUIX_PACKAGE_PATH paths: /home/oleg/src/guix-wigust /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist + /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist + /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist /tmp/noexist --8<---------------cut here---------------end--------------->8--- [-- Attachment #1.2: [PATCH] describe: Handle JSON and recutils formats for --] [-- Type: text/x-patch, Size: 2584 bytes --] From 4f911d60f96f088876e6bcbed1883cff637507c2 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov <go.wigust@gmail.com> Date: Sat, 16 Mar 2019 16:56:34 +0300 Subject: [PATCH] describe: Handle JSON and recutils formats for 'GUIX_PACKAGE_PATH'. Fixes <https://bugs.gnu.org/34884>. Reported by Pierre Neidhardt <mail@ambrevar.xyz>. * guix/scripts/describe.scm (display-package-search-path): Handle JSON and recutils formats. --- guix/scripts/describe.scm | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm index 7d0ecb0a4d..fbc142426e 100644 --- a/guix/scripts/describe.scm +++ b/guix/scripts/describe.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org> -;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> +;;; Copyright © 2018, 2019 Oleg Pykhalov <go.wigust@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -77,6 +77,16 @@ Display information about the channels currently in use.\n")) (define (display-package-search-path fmt) "Display GUIX_PACKAGE_PATH, if it is set, according to FMT." + (define* (paths->recutils paths #:optional (width (%text-width))) + (define width* + ;; The available number of columns once we've taken into account space + ;; for the initial "+ " prefix. + (if (> width 2) (- width 2) %text-width)) + + (string->recutils + (fill-paragraph (string-join (string-split paths #\:)) width* + (string-length "dependencies: ")))) + (match (getenv "GUIX_PACKAGE_PATH") (#f #t) (string @@ -84,8 +94,18 @@ Display information about the channels currently in use.\n")) ('human (format #t "~%GUIX_PACKAGE_PATH=\"~a\"~%" string)) ('channels - (format #t (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%") - string)))))) + (format (current-warning-port) + (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%") string)) + ('json + (format (current-warning-port) + (scm->json-string + `((name . "GUIX_PACKAGE_PATH") + (paths . ,(string-split string #\:)))))) + ('recutils + (format (current-warning-port) + "name: GUIX_PACKAGE_PATH") + (format (current-warning-port) + "~%paths: ~a~%~%" (paths->recutils string))))))) (define (channel->sexp channel) `(channel -- 2.21.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#34884: guix describe fails with --format=json and --format=recutils 2019-03-16 14:11 ` Oleg Pykhalov @ 2019-03-17 15:40 ` Ludovic Courtès 2019-03-17 17:40 ` Oleg Pykhalov 2019-03-18 8:45 ` Ricardo Wurmus 0 siblings, 2 replies; 6+ messages in thread From: Ludovic Courtès @ 2019-03-17 15:40 UTC (permalink / raw) To: Oleg Pykhalov; +Cc: Pierre Neidhardt, 34884 [-- Attachment #1: Type: text/plain, Size: 1306 bytes --] Hi Oleg, Oleg Pykhalov <go.wigust@gmail.com> skribis: > JSON format: > > oleg@guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=json > [{"name":"guix","url":"https://gitlab.wugi.info/guix/guix.git","commit":"4161deb4549c39b7d4801cc8aa63c365d19fc649"},{"name":"guix-wigust","url":"https://gitlab.wugi.info/guix/guix-wigust.git","commit":"f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0"}] > {"name":"GUIX_PACKAGE_PATH","paths":["/home/oleg/src/guix-wigust","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist"]} Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set and not captured in the output of ‘guix describe’, because fundamentally it cannot be captured reliably. Thus, what about something as attached instead? Thanks, Ludo’. [-- Attachment #2: Type: text/x-patch, Size: 904 bytes --] diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm index 7d0ecb0a4d..b6287d3a4c 100644 --- a/guix/scripts/describe.scm +++ b/guix/scripts/describe.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> ;;; ;;; This file is part of GNU Guix. @@ -85,7 +85,9 @@ Display information about the channels currently in use.\n")) (format #t "~%GUIX_PACKAGE_PATH=\"~a\"~%" string)) ('channels (format #t (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%") - string)))))) + string)) + (_ + (warning (G_ "'GUIX_PACKAGE_PATH' is set but it is not captured~%"))))))) (define (channel->sexp channel) `(channel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#34884: guix describe fails with --format=json and --format=recutils 2019-03-17 15:40 ` Ludovic Courtès @ 2019-03-17 17:40 ` Oleg Pykhalov 2019-03-18 8:52 ` Ludovic Courtès 2019-03-18 8:45 ` Ricardo Wurmus 1 sibling, 1 reply; 6+ messages in thread From: Oleg Pykhalov @ 2019-03-17 17:40 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Pierre Neidhardt, 34884 [-- Attachment #1: Type: text/plain, Size: 386 bytes --] Hi Ludovic, Ludovic Courtès <ludo@gnu.org> writes: […] > Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set > and not captured in the output of ‘guix describe’, because fundamentally > it cannot be captured reliably. > > Thus, what about something as attached instead? OK, no problem for me. ;-) Thanks for explanation. […] Oleg. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#34884: guix describe fails with --format=json and --format=recutils 2019-03-17 17:40 ` Oleg Pykhalov @ 2019-03-18 8:52 ` Ludovic Courtès 0 siblings, 0 replies; 6+ messages in thread From: Ludovic Courtès @ 2019-03-18 8:52 UTC (permalink / raw) To: Oleg Pykhalov; +Cc: Pierre Neidhardt, 34884-done Hi Oleg, Oleg Pykhalov <go.wigust@gmail.com> skribis: > Ludovic Courtès <ludo@gnu.org> writes: > > […] > >> Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set >> and not captured in the output of ‘guix describe’, because fundamentally >> it cannot be captured reliably. >> >> Thus, what about something as attached instead? > > OK, no problem for me. ;-) Thanks for explanation. Cool, thank you. I’ll push shortly. Ludo’. ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#34884: guix describe fails with --format=json and --format=recutils 2019-03-17 15:40 ` Ludovic Courtès 2019-03-17 17:40 ` Oleg Pykhalov @ 2019-03-18 8:45 ` Ricardo Wurmus 1 sibling, 0 replies; 6+ messages in thread From: Ricardo Wurmus @ 2019-03-18 8:45 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Pierre Neidhardt, 34884 Hi, > Oleg Pykhalov <go.wigust@gmail.com> skribis: > >> JSON format: >> >> oleg@guixsd ~/src/guix$ ./pre-inst-env env GUIX_PACKAGE_PATH=$HOME/src/guix-wigust:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist:/tmp/noexist guix describe -p ~/.config/guix/current --format=json >> [{"name":"guix","url":"https://gitlab.wugi.info/guix/guix.git","commit":"4161deb4549c39b7d4801cc8aa63c365d19fc649"},{"name":"guix-wigust","url":"https://gitlab.wugi.info/guix/guix-wigust.git","commit":"f6dfa5fc08824ebe5bdc42ea35ff0e040245c8c0"}] >> {"name":"GUIX_PACKAGE_PATH","paths":["/home/oleg/src/guix-wigust","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist","/tmp/noexist"]} > > Initially the intent was to warn users that ‘GUIX_PACKAGE_PATH’ is set > and not captured in the output of ‘guix describe’, because fundamentally > it cannot be captured reliably. > > Thus, what about something as attached instead? > > Thanks, > Ludo’. > > diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm > index 7d0ecb0a4d..b6287d3a4c 100644 > --- a/guix/scripts/describe.scm > +++ b/guix/scripts/describe.scm > @@ -1,5 +1,5 @@ > ;;; GNU Guix --- Functional package management for GNU > -;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org> > +;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org> > ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> > ;;; > ;;; This file is part of GNU Guix. > @@ -85,7 +85,9 @@ Display information about the channels currently in use.\n")) > (format #t "~%GUIX_PACKAGE_PATH=\"~a\"~%" string)) > ('channels > (format #t (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%") > - string)))))) > + string)) > + (_ > + (warning (G_ "'GUIX_PACKAGE_PATH' is set but it is not captured~%"))))))) > > (define (channel->sexp channel) > `(channel This looks good to me! -- Ricardo ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-03-18 8:53 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-03-16 10:12 bug#34884: guix describe fails with --format=json and --format=recutils Pierre Neidhardt 2019-03-16 14:11 ` Oleg Pykhalov 2019-03-17 15:40 ` Ludovic Courtès 2019-03-17 17:40 ` Oleg Pykhalov 2019-03-18 8:52 ` Ludovic Courtès 2019-03-18 8:45 ` Ricardo Wurmus
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).