guix_mirror_bot pushed a commit to branch master
in repository guix.
commit efd3e1400035a00662ca36876502d632c8d08c24
Author: Nicolas Graves <[email protected]>
AuthorDate: Wed Jun 24 21:44:11 2026 +0200
guix: json-utils: Deprecate with-atomic-json-file-replacement.
* guix/build/json-utils.scm (with-atomic-json-file-replacement*): New
variable.
(with-atomic-json-file-replacement): Define with
with-atomic-json-file-replacement* and deprecate.
Change-Id: I3646ef0b20fd9d53c10f94b82f741ce9f8e6d474
Signed-off-by: Jelle Licht <[email protected]>
---
guix/build/json-utils.scm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/guix/build/json-utils.scm b/guix/build/json-utils.scm
index ad31dcb8dac..1a5cba54ab3 100644
--- a/guix/build/json-utils.scm
+++ b/guix/build/json-utils.scm
@@ -47,8 +47,8 @@
;;; JSON modification procedures
;;;
-(define* (with-atomic-json-file-replacement proc
- #:optional (file "package.json"))
+;; This is the function we eventually want to migrate to.
+(define (with-atomic-json-file-replacement* file proc)
"Like 'with-atomic-file-replacement', but PROC is called with a single
argument---the result of parsing FILE's contents as JSON---and should produce
a value to be written as JSON to the replacement FILE."
@@ -56,6 +56,17 @@ a value to be written as JSON to the replacement FILE."
(lambda (in out)
(scm->json (proc (json->scm in #:ordered #t)) out #:pretty #t))))
+;; This is a deprecated version of the function that ought to be
+;; removed in favor of with-atomic-json-file-replacement*'s content eventually.
+;; On removal, also remove the (guix deprecation) modules and their closures
+;; from node-build-system imported-modules.
+(define* (with-atomic-json-file-replacement proc
+ #:optional (file "package.json"))
+ (with-atomic-json-file-replacement* file proc))
+
+(define-deprecated/public-alias with-atomic-json-file-replacement
+ with-atomic-json-file-replacement*)
+
;; This is the function we eventually want to migrate to.
(define* (modify-json* file #:rest modifications)
"Modify JSON FILE with successive callbacks."