guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 0aea1f0efeb54f18f34b58d3afb0b30d8e33b557
Author: Nicolas Graves <[email protected]>
AuthorDate: Tue Mar 31 15:08:32 2026 +0200
build-system/node: Deprecate and export json procedures.
* guix/build/node-build-system.scm (with-atomic-json-file-replacement)
(modify-json, modify-json-fields, delete-json-fields)
(replace-json-fields): Import, deprecate, then export them.
(delete-dev-dependencies, patch-dependencies): Use procedure variants
that are not deprecated yet.
Change-Id: I492e6e7f1f2e8972a2d2a1a037eb84270946e82b
Signed-off-by: Jelle Licht <[email protected]>
---
guix/build/json-utils.scm | 2 +-
guix/build/node-build-system.scm | 55 ++++++++++++++++++++++++++++++++++++----
2 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/guix/build/json-utils.scm b/guix/build/json-utils.scm
index 9d94fd85c4d..5090daf770e 100644
--- a/guix/build/json-utils.scm
+++ b/guix/build/json-utils.scm
@@ -75,7 +75,7 @@ a value to be written as JSON to the replacement FILE."
;; This is the function we eventually want to migrate to.
(define* (modify-json* file #:rest modifications)
"Modify JSON FILE with successive callbacks."
- (with-atomic-json-file-replacement file
+ (with-atomic-json-file-replacement* file
(apply compose modifications)))
;; Copied and adapted from (guix utils).
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index be715cc97b3..d08935eeed4 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -25,7 +25,15 @@
(define-module (guix build node-build-system)
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
- #:use-module (guix build json-utils)
+ #:use-module ((guix build json-utils)
+ #:select ((modify-json . modify-json*)
+ (modify-json-fields . modify-json-fields*)
+ (delete-json-fields . delete-json-fields*)
+ (replace-json-fields . replace-json-fields*)
+ (add-json-fields . add-json-fields*)
+ (with-atomic-json-file-replacement
+ . with-atomic-json-file-replacement*)))
+ #:use-module (guix deprecation)
#:use-module (guix build utils)
#:use-module (ice-9 format)
#:use-module (ice-9 ftw)
@@ -40,7 +48,17 @@
delete-dependencies/except
delete-dev-dependencies
delete-dev-dependencies/except
- node-build))
+ node-build
+ modify-json
+ delete-fields
+ replace-fields
+ add-fields)
+ #:re-export ((modify-json-fields* . modify-json-fields)
+ (delete-json-fields* . delete-json-fields)
+ (replace-json-fields* . replace-json-fields)
+ (add-json-fields* . add-json-fields)
+ (with-atomic-json-file-replacement*
+ . with-atomic-json-file-replacement)))
;;;
;;; Helpers
@@ -56,6 +74,33 @@
'("devDependencies"
"peerDependencies"))
+(define-deprecated/alias with-atomic-json-file-replacement
+ (@ (guix build json-utils) with-atomic-json-file-replacement))
+
+(define-deprecated/alias modify-json
+ (@ (guix build json-utils) modify-json))
+
+(define-deprecated/alias modify-json-fields
+ (@ (guix build json-utils) modify-json-fields))
+
+(define-deprecated/alias delete-fields
+ (@ (guix build json-utils) delete-json-fields))
+
+(define-deprecated/alias delete-json-fields
+ (@ (guix build json-utils) delete-json-fields))
+
+(define-deprecated/alias replace-fields
+ (@ (guix build json-utils) replace-json-fields))
+
+(define-deprecated/alias replace-json-fields
+ (@ (guix build json-utils) replace-json-fields))
+
+(define-deprecated/alias add-fields
+ (@ (guix build json-utils) add-json-fields))
+
+(define-deprecated/alias add-json-fields
+ (@ (guix build json-utils) add-json-fields))
+
(define* (delete-dependencies dependencies-to-remove
#:key negate?
(dependency-keys %dependency-keys))
@@ -96,8 +141,8 @@ dependencies."
#:dependency-keys %dev-dependency-keys))
(define (delete-dev-dependencies)
- (delete-json-fields (list "devDependencies" "peerDependencies")
- #:strict? #f))
+ (delete-json-fields* (list "devDependencies" "peerDependencies")
+ #:strict? #f))
;;;
;;; Phases.
@@ -154,7 +199,7 @@ dependencies."
(assoc-set! pkg-meta key
(resolve-dependencies (getter pkg-meta)))))
- (modify-json "package.json"
+ (modify-json* "package.json"
(resolve "devDependencies"
(lambda (pkg-meta)
(or (assoc-ref pkg-meta "devDependencies") '())))