From: "Ludovic Courtès" <ludo@gnu.org>
To: zimoun <zimon.toutoune@gmail.com>
Cc: 50515@debbugs.gnu.org
Subject: [bug#50515] (guix-artwork)[PATCH 0/2] List linux origins in 'sources.json'.
Date: Mon, 18 Oct 2021 14:23:49 +0200 [thread overview]
Message-ID: <87tuhea5d6.fsf_-_@gnu.org> (raw)
In-Reply-To: <20211005140937.19272-2-zimon.toutoune@gmail.com> (zimoun's message of "Tue, 5 Oct 2021 16:09:37 +0200")
Hi!
zimoun <zimon.toutoune@gmail.com> skribis:
> With Guix 9875f9bca3976bf3576eab9be42164fde454597e, the packages considered
> are IceCat and the Linux kernel; see: gnu/packages/gnuzilla.scm and
> gnu/packages/linux.scm.
>
> * website/apps/packages/builder.scm (gexp-references): Unexported procedure
> from the module '(guix gexp)'.
> (origin->json): Add 'computed-origin-method' case.
> (package-json-builder): Adjust.
> (sources-json-builder): Idem.
> [flatten]: New procedure.
Apologies for the looong delay!
> +;;; Required by 'origin->json' for 'computed-origin-method' corner cases
> +(define gexp-references (@@ (guix gexp) gexp-references))
Hmm not great. The only public API that would allow us to approximate
it is ‘lower-gexp’, but it requires access to the daemon, so it’s not
suitable.
Let’s keep it this way!
> (define (package->json package)
> `(,@(if (origin? (package-source package))
> (origin->json (package-source package))
> - `(("type" . "no-origin")
> + `((type . "no-origin")
> ("name" . ,(package-name package))))))
>
> + (define (flatten lst)
> + ;; Convert nested lists to simple list
> + `(,@(if (null? lst)
> + '()
> + (match lst
> + ((head tail ...)
> + (match head
> + ((('type . x) other ...)
> + (cons head (flatten tail)))
> + (_
> + (append (flatten head) (flatten tail)))))))))
> +
> (make-page "sources.json"
> - `(("sources" . ,(list->vector (map package->json (all-packages))))
> + `(("sources" . ,(list->vector (flatten (map package->json (all-packages)))))
Maybe we should just change ‘package->json’ to always return a list of
JSON records (alists)? That way, we would write:
(append-map package->json (all-packages))
which I find slightly clearer.
WDYT?
Otherwise LGTM, thanks!
Ludo’.
next prev parent reply other threads:[~2021-10-18 12:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-11 0:14 [bug#50515] (guix-artwork)[PATCH 0/2] List linux origins in 'sources.json' zimoun
2021-09-11 0:26 ` [bug#50515] [PATCH 1/2] website: Tweak 'GUIX_WEB_SITE_LOCAL' zimoun
2021-09-11 0:26 ` [bug#50515] [PATCH 2/2] website: Add 'computed-origin-method' packages to 'sources.json' zimoun
2021-10-01 14:16 ` zimoun
2021-10-04 7:53 ` Ludovic Courtès
2021-10-05 14:09 ` zimoun
2021-09-12 0:54 ` Mark H Weaver
2021-09-13 7:01 ` zimoun
2021-09-16 0:07 ` Mark H Weaver
2021-09-16 11:48 ` zimoun
2021-10-05 14:09 ` [bug#50515] [PATCH v2 1/2] website: Tweak 'GUIX_WEB_SITE_LOCAL' zimoun
2021-10-05 14:09 ` [bug#50515] [PATCH v2 2/2] website: Add 'computed-origin-method' packages to 'sources.json' zimoun
2021-10-18 12:23 ` Ludovic Courtès [this message]
2021-10-21 9:42 ` [bug#50515] (guix-artwork)[PATCH 0/2] List linux origins in 'sources.json' zimoun
2021-10-21 9:41 ` [bug#50515] [PATCH v3 1/2] website: Tweak 'GUIX_WEB_SITE_LOCAL' zimoun
2021-10-21 9:41 ` [bug#50515] [PATCH v3 2/2] website: Add 'computed-origin-method' packages to 'sources.json' zimoun
2021-10-21 20:58 ` bug#50515: (guix-artwork)[PATCH 0/2] List linux origins in 'sources.json' Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tuhea5d6.fsf_-_@gnu.org \
--to=ludo@gnu.org \
--cc=50515@debbugs.gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).