Subject: [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.

From: Liliana Marie Prikler <[email-masked]>
Date: Fri, 17 Dec 2021 05:43:23 +0100

Hi,

Am Donnerstag, dem 16.12.2021 um 21:02 -0500 schrieb Philip McGrath:
> * guix/build-system/node.scm (lower, node-build): Add optional
> argument #:absent-dependencies with default of ''(). Pass it on
> to the build-side code.
> * guix/build/node-build-system.scm (patch-dependencies): Respect
> the #:absent-dependencies argument, removing specified npm
> packages from the "dependencies" or "devDependencies" tables
> in "package.json".
> [...]
> +                (absent-dependencies ''())
> [...]
> +                     (absent-dependencies ''())
> [...]
> -(define* (patch-dependencies #:key inputs #:allow-other-keys)
> +(define* (patch-dependencies #:key inputs absent-dependencies
> +                             #:allow-other-keys)
>  
>    (define index (index-modules (map cdr inputs)))
>  
> @@ -86,7 +87,9 @@ (define (resolve-dependencies meta-alist meta-key)
>        (('@ . orig-deps)
>         (fold (match-lambda*
>                 (((key . value) acc)
> -                (acons key (hash-ref index key value) acc)))
> +                (if (member key absent-dependencies)
> +                    acc
> +                    (acons key (hash-ref index key value) acc))))
>               '()
>               orig-deps))))
I might be sounding like a broken record here, but again for the sake
of being able to add or remove inputs on the user side without
duplicated efforts, I'd use something else in lieu of absent-
dependencies.  For the time being, I think a switch between "fail" and
"warn about missing dependencies" ought to be enough.  In the future,
we might want to make it so that packages can specify which
dependencies they absolutely require and which they don't (or if
possible infer that from dependencies).  WDYT?