guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#33448] [PATCH] describe: Add json format.


From: Ludovic Courtès
Subject: [bug#33448] [PATCH] describe: Add json format.
Date: Wed, 21 Nov 2018 11:53:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Oleg Pykhalov <address@hidden> 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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]