GNU bug report logs - #51838
[PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.

Previous Next

Package: guix-patches;

Reported by: Philip McGrath <philip <at> philipmcgrath.com>

Date: Sun, 14 Nov 2021 12:43:01 UTC

Severity: normal

Tags: patch

Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Philip McGrath <philip <at> philipmcgrath.com>
To: 51838 <at> debbugs.gnu.org
Cc: Timothy Sample <samplet <at> ngyro.com>, Pierre Langlois <pierre.langlois <at> gmx.com>, Jelle Licht <jlicht <at> fsfe.org>, Philip McGrath <philip <at> philipmcgrath.com>, Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Subject: [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
Date: Thu, 30 Dec 2021 02:38:43 -0500
* guix/build/node-build-system.scm (delete-dependencies): New exported
procedure.  Functionally updates a "package.json"-like value by removing
specified npm packages from the "dependencies" and "devDependencies"
objects.
---
 guix/build/node-build-system.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index dc8b6a41c2..9967223b86 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -27,6 +27,7 @@ (define-module (guix build node-build-system)
   #:use-module (srfi srfi-1)
   #:export (%standard-phases
             with-atomic-json-file-replacement
+            delete-dependencies
             node-build))
 
 ;; Commentary:
@@ -325,6 +326,23 @@ (define resolve-dependencies
                                deps))))))
   #t)
 
+(define (delete-dependencies pkg-meta absent-dependencies)
+  "Functionally update PKG-META, a json object corresponding to a
+'package.json' file, to allow building without the ABSENT-DEPENDENCIES.  To
+avoid reintroducing the ABSENT-DEPENDENCIES, only use this procedure after the
+'patch-dependencies' phase."
+  (define delete-fom-jsobject
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (filter (match-lambda
+                          ((k . v)
+                           (not (member k absent-dependencies))))
+                        alist)))))
+  (jsobject-update*
+   pkg-meta
+   "devDependencies" '(@) delete-fom-jsobject
+   "dependencies" '(@) delete-fom-jsobject))
+
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
   "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
 exist."
-- 
2.32.0





This bug report was last modified 3 years and 195 days ago.

Previous Next


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