GNU bug report logs -
#33448
[PATCH] describe: Fix 'format' option.
Previous Next
Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>
Date: Tue, 20 Nov 2018 22:27:01 UTC
Severity: normal
Tags: patch
Merged with 33453
Done: Oleg Pykhalov <go.wigust <at> gmail.com>
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 33448 in the body.
You can then email your comments to 33448 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Tue, 20 Nov 2018 22:27:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Oleg Pykhalov <go.wigust <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 20 Nov 2018 22:27:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Fix ‘guix describe’ ignores ‘--format=FORMAT’ option.
* guix/scripts/describe.scm (%options): Fix 'format' option.
---
guix/scripts/describe.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index e59502076..d3203e992 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -40,7 +40,7 @@
(lambda (opt name arg result)
(unless (member arg '("human" "channels"))
(leave (G_ "~a: unsupported output format~%") arg))
- (alist-cons 'format 'channels result)))
+ (alist-cons 'format (string->symbol arg) result)))
(option '(#\h "help") #f #f
(lambda args
(show-help)
--
2.19.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 07:02:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 33448 <at> debbugs.gnu.org (full text, mbox):
* guix/scripts/describe.scm: Add json format.
---
guix/scripts/describe.scm | 69 +++++++++++++++++++++++++--------------
1 file changed, 44 insertions(+), 25 deletions(-)
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index d3203e992..53195b423 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -23,6 +23,7 @@
#:use-module (guix profiles)
#:use-module ((guix scripts pull) #:select (display-profile-content))
#:use-module (git)
+ #:use-module (json)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-37)
#:use-module (ice-9 match)
@@ -38,7 +39,7 @@
;; Specifications of the command-line options.
(list (option '(#\f "format") #t #f
(lambda (opt name arg result)
- (unless (member arg '("human" "channels"))
+ (unless (member arg '("human" "channels" "json"))
(leave (G_ "~a: unsupported output format~%") arg))
(alist-cons 'format (string->symbol arg) result)))
(option '(#\h "help") #f #f
@@ -101,7 +102,12 @@ within a Git checkout."
(pretty-print `(list (channel
(name 'guix)
(url ,(dirname directory))
- (commit ,commit))))))
+ (commit ,commit)))))
+ ('json
+ (display (scm->json-string `((name . guix)
+ (url . ,(dirname directory))
+ (commit . ,commit))))
+ (newline)))
(display-package-search-path fmt)))
(define (display-profile-info profile fmt)
@@ -110,34 +116,47 @@ in the format specified by FMT."
(define number
(generation-number profile))
+ (define (channels format)
+ (map (lambda (entry)
+ (match (assq 'source (manifest-entry-properties entry))
+ (('source ('repository ('version 0)
+ ('url url)
+ ('branch branch)
+ ('commit commit)
+ _ ...))
+ (case format
+ ((scm)
+ `(channel (name ',(string->symbol
+ (manifest-entry-name entry)))
+ (url ,url)
+ (commit ,commit)))
+ ((json)
+ `((name . ,(string->symbol
+ (manifest-entry-name entry)))
+ (url . ,url)
+ (commit . ,commit)))))
+
+ ;; Pre-0.15.0 Guix does not provide that information,
+ ;; so there's not much we can do in that case.
+ (_ '???)))
+
+ ;; Show most recently installed packages last.
+ (reverse
+ (manifest-entries
+ (profile-manifest
+ (if (zero? number)
+ profile
+ (generation-file-name profile number)))))))
+
(match fmt
('human
(display-profile-content profile number))
('channels
(pretty-print
- `(list ,@(map (lambda (entry)
- (match (assq 'source (manifest-entry-properties entry))
- (('source ('repository ('version 0)
- ('url url)
- ('branch branch)
- ('commit commit)
- _ ...))
- `(channel (name ',(string->symbol
- (manifest-entry-name entry)))
- (url ,url)
- (commit ,commit)))
-
- ;; Pre-0.15.0 Guix does not provide that information,
- ;; so there's not much we can do in that case.
- (_ '???)))
-
- ;; Show most recently installed packages last.
- (reverse
- (manifest-entries
- (profile-manifest
- (if (zero? number)
- profile
- (generation-file-name profile number))))))))))
+ `(list ,@(channels 'scm))))
+ ('json
+ (display (scm->json-string (channels 'json)))
+ (newline)))
(display-package-search-path fmt))
--
2.19.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 10:48:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 33448 <at> debbugs.gnu.org (full text, mbox):
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> Fix ‘guix describe’ ignores ‘--format=FORMAT’ option.
>
> * guix/scripts/describe.scm (%options): Fix 'format' option.
Oops, good catch. LGTM!
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 10:54:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 33448 <at> debbugs.gnu.org (full text, mbox):
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> * guix/scripts/describe.scm: Add json format.
Please describe the modified and added variables/procedures.
> + (define (channels format)
> + (map (lambda (entry)
> + (match (assq 'source (manifest-entry-properties entry))
> + (('source ('repository ('version 0)
> + ('url url)
> + ('branch branch)
> + ('commit commit)
> + _ ...))
> + (case format
> + ((scm)
> + `(channel (name ',(string->symbol
> + (manifest-entry-name entry)))
> + (url ,url)
> + (commit ,commit)))
> + ((json)
> + `((name . ,(string->symbol
> + (manifest-entry-name entry)))
> + (url . ,url)
> + (commit . ,commit)))))
> +
> + ;; Pre-0.15.0 Guix does not provide that information,
> + ;; so there's not much we can do in that case.
> + (_ '???)))
> +
> + ;; Show most recently installed packages last.
> + (reverse
> + (manifest-entries
> + (profile-manifest
> + (if (zero? number)
> + profile
> + (generation-file-name profile number)))))))
How about turning this into a list of <channel> objects, and then,
separately have ‘channels->sexp’ and ‘channels->json’? That would avoid
having dealing with the format in two different places.
Also, could you mention the new format in the manual?
Last question: what use case do you have in mind regarding the JSON
format? I’m asking because we don’t have tools that can consume it so
far.
Thanks,
Ludo’.
Merged 33448 33453.
Request was from
ludo <at> gnu.org (Ludovic Courtès)
to
control <at> debbugs.gnu.org
.
(Wed, 21 Nov 2018 10:55:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 11:49:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 33448 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:
> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>
>> Fix ‘guix describe’ ignores ‘--format=FORMAT’ option.
>>
>> * guix/scripts/describe.scm (%options): Fix 'format' option.
>
> Oops, good catch. LGTM!
Pushed as 3dd28aa37cc3f3a6bbb5f7f8d9fb49cc457b0c10
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 14:11:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 33448 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello Ludovic,
Apologies for created previously separate bug reports of same patch
series.
ludo <at> gnu.org (Ludovic Courtès) writes:
> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>
>> * guix/scripts/describe.scm: Add json format.
>
> Please describe the modified and added variables/procedures.
>
>> + (define (channels format)
>> + (map (lambda (entry)
>> + …
>> + (generation-file-name profile number)))))))
Ups, I'll do this in followign patch series.
> How about turning this into a list of <channel> objects, and then,
> separately have ‘channels->sexp’ and ‘channels->json’? That would avoid
> having dealing with the format in two different places.
>
> Also, could you mention the new format in the manual?
>
> Last question: what use case do you have in mind regarding the JSON
> format? I’m asking because we don’t have tools that can consume it so
> far.
Well, I wanted to get a command line way to select things in ‘guix
channel’ output, e.g. to get a current ‘guix’ channel commit:
--8<---------------cut here---------------start------------->8---
./pre-inst-env guix describe --profile=$HOME/.config/guix/current --format=json | jq --raw-output 'map(select(.name == "guix"))'[0].commit
--8<---------------cut here---------------end--------------->8---
I didn't think that ‘recsel’ actually could be used in the same way:
--8<---------------cut here---------------start------------->8---
./pre-inst-env guix describe --profile=$HOME/.config/guix/current --format=recutils | recsel -e 'name = "guix"' -P commit
--8<---------------cut here---------------end--------------->8---
I'll send new patch series following current message.
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 14:18:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 33448 <at> debbugs.gnu.org (full text, mbox):
* guix/channels.scm (channel->sexp): New procedure.
* guix/scripts/describe.scm (display-checkout-info, display-profile-info): Use
this.
---
guix/channels.scm | 9 +++++++
guix/scripts/describe.scm | 57 ++++++++++++++++++++-------------------
2 files changed, 38 insertions(+), 28 deletions(-)
diff --git a/guix/channels.scm b/guix/channels.scm
index 82389eb58..bfdbf470b 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -39,6 +39,7 @@
channel-commit
channel-location
+ channel->sexp
%default-channels
channel-instance?
@@ -85,6 +86,14 @@
"Return true if CHANNEL is the 'guix' channel."
(eq? 'guix (channel-name channel)))
+(define channel->sexp
+ (match-lambda
+ (($ <channel> name url branch commit location)
+ `(channel
+ (name ,name)
+ (url ,url)
+ (commit ,commit)))))
+
(define-record-type <channel-instance>
(channel-instance channel commit checkout)
channel-instance?
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index d817d7f7c..6a30d19b1 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -18,6 +18,7 @@
(define-module (guix scripts describe)
#:use-module ((guix ui) #:hide (display-profile-content))
+ #:use-module (guix channels)
#:use-module (guix scripts)
#:use-module (guix describe)
#:use-module (guix profiles)
@@ -104,10 +105,9 @@ within a Git checkout."
(format #t (G_ " branch: ~a~%") (reference-shorthand head))
(format #t (G_ " commit: ~a~%") commit))
('channels
- (pretty-print `(list (channel
- (name 'guix)
- (url ,(dirname directory))
- (commit ,commit))))))
+ (pretty-print (channel->sexp (channel (name 'guix)
+ (url (dirname directory))
+ (commit commit))))))
(display-package-search-path fmt)))
(define (display-profile-info profile fmt)
@@ -116,34 +116,35 @@ in the format specified by FMT."
(define number
(generation-number profile))
+ (define (channels)
+ (map (lambda (entry)
+ (match (assq 'source (manifest-entry-properties entry))
+ (('source ('repository ('version 0)
+ ('url url)
+ ('branch branch)
+ ('commit commit)
+ _ ...))
+ (channel (name (string->symbol (manifest-entry-name entry)))
+ (url url)
+ (commit commit)))
+
+ ;; Pre-0.15.0 Guix does not provide that information,
+ ;; so there's not much we can do in that case.
+ (_ '???)))
+
+ ;; Show most recently installed packages last.
+ (reverse
+ (manifest-entries
+ (profile-manifest
+ (if (zero? number)
+ profile
+ (generation-file-name profile number)))))))
+
(match fmt
('human
(display-profile-content profile number))
('channels
- (pretty-print
- `(list ,@(map (lambda (entry)
- (match (assq 'source (manifest-entry-properties entry))
- (('source ('repository ('version 0)
- ('url url)
- ('branch branch)
- ('commit commit)
- _ ...))
- `(channel (name ',(string->symbol
- (manifest-entry-name entry)))
- (url ,url)
- (commit ,commit)))
-
- ;; Pre-0.15.0 Guix does not provide that information,
- ;; so there's not much we can do in that case.
- (_ '???)))
-
- ;; Show most recently installed packages last.
- (reverse
- (manifest-entries
- (profile-manifest
- (if (zero? number)
- profile
- (generation-file-name profile number))))))))))
+ (pretty-print (map channel->sexp (channels)))))
(display-package-search-path fmt))
--
2.19.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 14:18:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 33448 <at> debbugs.gnu.org (full text, mbox):
* guix/channels.scm (channel->json): New procedure.
* guix/scripts/describe.scm (%options): Add 'json' option.
(display-checkout-info, display-profile-info): Use 'channel->json'.
* doc/guix.texi (Invoking guix describe): Document this.
---
doc/guix.texi | 5 ++++-
guix/channels.scm | 12 ++++++++++++
guix/scripts/describe.scm | 13 ++++++++++---
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 082e81bf7..3413eb30f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3273,7 +3273,10 @@ produce human-readable output;
@item channels
produce a list of channel specifications that can be passed to @command{guix
pull -C} or installed as @file{~/.config/guix/channels.scm} (@pxref{Invoking
-guix pull}).
+guix pull});
+@item json
+@cindex JSON
+produce a list of channel specifications in JSON format.
@end table
@item --profile=@var{profile}
diff --git a/guix/channels.scm b/guix/channels.scm
index bfdbf470b..9f2c9103e 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -26,6 +26,7 @@
#:use-module (guix derivations)
#:use-module (guix store)
#:use-module (guix i18n)
+ #:use-module (json)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-11)
@@ -39,7 +40,9 @@
channel-commit
channel-location
+ channel->json
channel->sexp
+
%default-channels
channel-instance?
@@ -94,6 +97,15 @@
(url ,url)
(commit ,commit)))))
+(define channel->json
+ (match-lambda
+ (($ <channel> name url branch commit location)
+ (scm->json-string
+ (list
+ (cons 'name name)
+ (cons 'url url)
+ (cons 'commit commit))))))
+
(define-record-type <channel-instance>
(channel-instance channel commit checkout)
channel-instance?
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index 6a30d19b1..d7e276769 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -39,7 +39,7 @@
;; Specifications of the command-line options.
(list (option '(#\f "format") #t #f
(lambda (opt name arg result)
- (unless (member arg '("human" "channels"))
+ (unless (member arg '("human" "channels" "json"))
(leave (G_ "~a: unsupported output format~%") arg))
(alist-cons 'format (string->symbol arg) result)))
(option '(#\p "profile") #t #f
@@ -107,7 +107,12 @@ within a Git checkout."
('channels
(pretty-print (channel->sexp (channel (name 'guix)
(url (dirname directory))
- (commit commit))))))
+ (commit commit)))))
+ ('json
+ (display (channel->json (channel (name 'guix)
+ (url (dirname directory))
+ (commit commit))))
+ (newline)))
(display-package-search-path fmt)))
(define (display-profile-info profile fmt)
@@ -144,7 +149,9 @@ in the format specified by FMT."
('human
(display-profile-content profile number))
('channels
- (pretty-print (map channel->sexp (channels)))))
+ (pretty-print (map channel->sexp (channels))))
+ ('json
+ (format #t "[~a]~%" (string-join (map channel->json (channels)) ","))))
(display-package-search-path fmt))
--
2.19.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 14:18:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 33448 <at> debbugs.gnu.org (full text, mbox):
* guix/channels.scm (channel->recutils): New procedure.
* guix/scripts/describe.scm (%options): Add 'recutils' option.
(display-checkout-info, display-profile-info): Use 'channel->recutils'.
* doc/guix.texi (Invoking guix describe): Document this.
---
doc/guix.texi | 4 +++-
guix/channels.scm | 8 ++++++++
guix/scripts/describe.scm | 18 +++++++++++++++---
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 3413eb30f..44594d168 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3276,7 +3276,9 @@ pull -C} or installed as @file{~/.config/guix/channels.scm} (@pxref{Invoking
guix pull});
@item json
@cindex JSON
-produce a list of channel specifications in JSON format.
+produce a list of channel specifications in JSON format;
+@item recutils
+produce a list of channel specifications in Recutils format.
@end table
@item --profile=@var{profile}
diff --git a/guix/channels.scm b/guix/channels.scm
index 9f2c9103e..ed9bc67c3 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -41,6 +41,7 @@
channel-location
channel->json
+ channel->recutils
channel->sexp
%default-channels
@@ -106,6 +107,13 @@
(cons 'url url)
(cons 'commit commit))))))
+(define (channel->recutils c port)
+ (match c
+ (($ <channel> name url branch commit location)
+ (format port "name: ~a~%" name)
+ (format port "url: ~a~%" url)
+ (format port "commit: ~a~%" commit))))
+
(define-record-type <channel-instance>
(channel-instance channel commit checkout)
channel-instance?
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index d7e276769..90365b7ae 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -39,7 +39,7 @@
;; Specifications of the command-line options.
(list (option '(#\f "format") #t #f
(lambda (opt name arg result)
- (unless (member arg '("human" "channels" "json"))
+ (unless (member arg '("human" "channels" "json" "recutils"))
(leave (G_ "~a: unsupported output format~%") arg))
(alist-cons 'format (string->symbol arg) result)))
(option '(#\p "profile") #t #f
@@ -112,7 +112,12 @@ within a Git checkout."
(display (channel->json (channel (name 'guix)
(url (dirname directory))
(commit commit))))
- (newline)))
+ (newline))
+ ('recutils
+ (channel->recutils (channel (name 'guix)
+ (url (dirname directory))
+ (commit commit))
+ #t)))
(display-package-search-path fmt)))
(define (display-profile-info profile fmt)
@@ -151,7 +156,14 @@ in the format specified by FMT."
('channels
(pretty-print (map channel->sexp (channels))))
('json
- (format #t "[~a]~%" (string-join (map channel->json (channels)) ","))))
+ (format #t "[~a]~%" (string-join (map channel->json (channels)) ",")))
+ ('recutils
+ (format #t "~{~a~%~}"
+ (map (lambda (channel)
+ (with-output-to-string
+ (lambda ()
+ (channel->recutils channel (current-output-port)))))
+ (channels)))))
(display-package-search-path fmt))
--
2.19.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 21:32:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 33448 <at> debbugs.gnu.org (full text, mbox):
Hi,
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> * guix/channels.scm (channel->sexp): New procedure.
> * guix/scripts/describe.scm (display-checkout-info, display-profile-info): Use
> this.
[...]
> + (define (channels)
s/define (channels)/define channels/ :-)
> + (map (lambda (entry)
> + (match (assq 'source (manifest-entry-properties entry))
> + (('source ('repository ('version 0)
> + ('url url)
> + ('branch branch)
> + ('commit commit)
> + _ ...))
> + (channel (name (string->symbol (manifest-entry-name entry)))
> + (url url)
> + (commit commit)))
> +
> + ;; Pre-0.15.0 Guix does not provide that information,
> + ;; so there's not much we can do in that case.
> + (_ '???)))
Maybe return, say: (channel (name 'guix)(url "?")(commit "?")).
This would avoid weird type errors.
> + (pretty-print (map channel->sexp (channels)))))
I think it should be:
(pretty-print `(list ,@(map channel->sexp channels)))
right?
OK with these changes, thanks!
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 21:34:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 33448 <at> debbugs.gnu.org (full text, mbox):
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> * guix/channels.scm (channel->json): New procedure.
> * guix/scripts/describe.scm (%options): Add 'json' option.
> (display-checkout-info, display-profile-info): Use 'channel->json'.
> * doc/guix.texi (Invoking guix describe): Document this.
[...]
> +(define channel->json
> + (match-lambda
> + (($ <channel> name url branch commit location)
> + (scm->json-string
> + (list
> + (cons 'name name)
> + (cons 'url url)
> + (cons 'commit commit))))))
Since this is not a core feature of channels and add a dependency on
(json), what about moving this procedure to (guix scripts describe)?
(‘channel->sexp’ could got to (guix scripts describe) as well maybe; no
big deal.)
Otherwise LGTM!
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 21:35:01 GMT)
Full text and
rfc822 format available.
Message #40 received at 33448 <at> debbugs.gnu.org (full text, mbox):
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> * guix/channels.scm (channel->recutils): New procedure.
> * guix/scripts/describe.scm (%options): Add 'recutils' option.
> (display-checkout-info, display-profile-info): Use 'channel->recutils'.
> * doc/guix.texi (Invoking guix describe): Document this.
[...]
> +(define (channel->recutils c port)
> + (match c
> + (($ <channel> name url branch commit location)
> + (format port "name: ~a~%" name)
> + (format port "url: ~a~%" url)
> + (format port "commit: ~a~%" commit))))
Same thing here: I’d have a preference for moving it to (guix scripts
describe).
Otherwise LGTM, thanks!
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Wed, 21 Nov 2018 21:37:02 GMT)
Full text and
rfc822 format available.
Message #43 received at 33448 <at> debbugs.gnu.org (full text, mbox):
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> ludo <at> gnu.org (Ludovic Courtès) writes:
[...]
>> Last question: what use case do you have in mind regarding the JSON
>> format? I’m asking because we don’t have tools that can consume it so
>> far.
>
> Well, I wanted to get a command line way to select things in ‘guix
> channel’ output, e.g. to get a current ‘guix’ channel commit:
>
> ./pre-inst-env guix describe --profile=$HOME/.config/guix/current --format=json | jq --raw-output 'map(select(.name == "guix"))'[0].commit
>
>
> I didn't think that ‘recsel’ actually could be used in the same way:
>
> ./pre-inst-env guix describe --profile=$HOME/.config/guix/current --format=recutils | recsel -e 'name = "guix"' -P commit
I see, that makes sense. It’s OK to have both JSON and recutils.
Thank you!
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Thu, 22 Nov 2018 12:55:01 GMT)
Full text and
rfc822 format available.
Message #46 received at 33448 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
ludo <at> gnu.org (Ludovic Courtès) writes:
> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>
>> * guix/channels.scm (channel->sexp): New procedure.
>> * guix/scripts/describe.scm (display-checkout-info, display-profile-info): Use
>> this.
[…]
>> + (pretty-print (map channel->sexp (channels)))))
>
> I think it should be:
>
> (pretty-print `(list ,@(map channel->sexp channels)))
Ouch, ‘list’ in in 'display-checkout-info' should be too. Apologies.
Oleg.
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Thu, 22 Nov 2018 12:55:02 GMT)
Full text and
rfc822 format available.
Message #49 received at 33448 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Ludovic,
Almost done with current patch series and only one question.
ludo <at> gnu.org (Ludovic Courtès) writes:
> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>
>> * guix/channels.scm (channel->json): New procedure.
>> * guix/scripts/describe.scm (%options): Add 'json' option.
>> (display-checkout-info, display-profile-info): Use 'channel->json'.
>> * doc/guix.texi (Invoking guix describe): Document this.
>
> [...]
>
>> +(define channel->json
>> + (match-lambda
>> + (($ <channel> name url branch commit location)
>> + (scm->json-string
>> + (list
>> + (cons 'name name)
>> + (cons 'url url)
>> + (cons 'commit commit))))))
>
> Since this is not a core feature of channels and add a dependency on
> (json), what about moving this procedure to (guix scripts describe)?
<channel> should be exported in (guix channels) in this case. Is it OK?
[…]
Oleg.
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Thu, 22 Nov 2018 16:54:01 GMT)
Full text and
rfc822 format available.
Message #52 received at 33448 <at> debbugs.gnu.org (full text, mbox):
Hi Oleg,
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> Almost done with current patch series and only one question.
>
> ludo <at> gnu.org (Ludovic Courtès) writes:
>
>> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>>
>>> * guix/channels.scm (channel->json): New procedure.
>>> * guix/scripts/describe.scm (%options): Add 'json' option.
>>> (display-checkout-info, display-profile-info): Use 'channel->json'.
>>> * doc/guix.texi (Invoking guix describe): Document this.
>>
>> [...]
>>
>>> +(define channel->json
>>> + (match-lambda
>>> + (($ <channel> name url branch commit location)
>>> + (scm->json-string
>>> + (list
>>> + (cons 'name name)
>>> + (cons 'url url)
>>> + (cons 'commit commit))))))
>>
>> Since this is not a core feature of channels and add a dependency on
>> (json), what about moving this procedure to (guix scripts describe)?
>
> <channel> should be exported in (guix channels) in this case. Is it OK?
No I think we should avoid exporting <channel>, but anyway we can write
this procedure as:
(lambda (channel)
(scm->json-string `((name . ,(channel-name channel)) …)))
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#33448
; Package
guix-patches
.
(Thu, 22 Nov 2018 18:24:02 GMT)
Full text and
rfc822 format available.
Message #55 received at 33448 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:
[…]
>> <channel> should be exported in (guix channels) in this case. Is it OK?
>
> No I think we should avoid exporting <channel>, but anyway we can write
> this procedure as:
>
> (lambda (channel)
> (scm->json-string `((name . ,(channel-name channel)) …)))
Oh, sure. Thank you for a reminder.
Pushed as:
--8<---------------cut here---------------start------------->8---
85e9c4b91990008f2b6b07c5de6f14427d7c3a06 describe: Add recutils format.
81a40ee0cb925bc39e3044bddcfdd38ddb04f04d describe: Add json format.
8548f995494d8d6358e6a8d7bc3b3bb5a0cbecb5 describe: Use a procedure to format output.
--8<---------------cut here---------------end--------------->8---
Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]
Reply sent
to
Oleg Pykhalov <go.wigust <at> gmail.com>
:
You have taken responsibility.
(Thu, 22 Nov 2018 18:24:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Oleg Pykhalov <go.wigust <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 22 Nov 2018 18:24:03 GMT)
Full text and
rfc822 format available.
Reply sent
to
Oleg Pykhalov <go.wigust <at> gmail.com>
:
You have taken responsibility.
(Thu, 22 Nov 2018 18:24:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Oleg Pykhalov <go.wigust <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 22 Nov 2018 18:24:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 21 Dec 2018 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 100 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.