GNU bug report logs - #74900
[PATCH] Replace (guix build json) with (json) in node build system

Previous Next

Package: guix-patches;

Reported by: Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>

Date: Sun, 15 Dec 2024 20:31:01 UTC

Severity: normal

Tags: patch

Done: Jelle Licht <jlicht <at> fsfe.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 74900 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>
Cc: Jelle Licht <jlicht <at> fsfe.org>, 74900 <at> debbugs.gnu.org
Subject: Re: [bug#74900] [PATCH 1/2] Replace (guix build json) with (json)
 in node-build-system
Date: Fri, 17 Jan 2025 21:36:19 +0100
Hi Daniel,

Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com> skribis:

> This change replaces the use of (guix build json) with (json) for the
> node ecosystem.
> Since guile-json is a dependency of Guix, and it's used elsewhere in
> the project, it makes sense to use this instead of rolling our own
> JSON implementation with (guix build json).
>
> (guix build json) also has a few issues:
>  - write-json escapes forward slashes in strings for some reason ("/"
> become "\/")
>  - read-json produces a structure similar to an association list but
> with '@' to indicate an object, making it not possible to use
> association list procedures directly.
>
> This is one step to move away from (guix build json), there will be
> other changes to remove the other uses of it.

Thanks for working on this!  This is tedious but important work.

Cc’ing Jelle, who knows Node packaging well.  Could you take a look,
Jelle?

One note:

>  (define %node-build-system-modules
>    ;; Build-side modules imported by default.
>    `((guix build node-build-system)
> -    (guix build json)
> +    (json)
> +    (json builder)
> +    (json parser)
> +    (json record)
>      ,@%default-gnu-imported-modules))

This ends up being used like so:

  (with-imported-modules %node-build-system-modules
    #~(…))

The effect is to copy (json …) from the user’s load path into the build
environment.  But this is not what we want, because one user might have
Guile-JSON 4.1 while another one has 4.7, and so they’d get different
derivations.

Instead, we should do:

  (with-extensions (list guile-json)
    (with-imported-modules %node-build-system-modules
      #~(…)))

With extra care to resolve ‘guile-json’ lazily via ‘module-ref’.

Thanks,
Ludo’.




This bug report was last modified 95 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.