GNU bug report logs -
#40629
Build and install packages from JSON definitions
Previous Next
Reported by: Ricardo Wurmus <rekado <at> elephly.net>
Date: Tue, 14 Apr 2020 16:45:01 UTC
Severity: normal
Done: Ricardo Wurmus <rekado <at> elephly.net>
Bug is archived. No further changes may be made.
Full log
Message #23 received at 40629 <at> debbugs.gnu.org (full text, mbox):
* guix/import/json.scm (json->code): Export procedure.
* guix/scripts/import/json.scm (guix-import-json): Use json->code.
---
guix/import/json.scm | 1 +
guix/scripts/import/json.scm | 12 +++---------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/guix/import/json.scm b/guix/import/json.scm
index 16dc2ad5cb..8f8dbbd05d 100644
--- a/guix/import/json.scm
+++ b/guix/import/json.scm
@@ -28,6 +28,7 @@
#:use-module (srfi srfi-2)
#:use-module (srfi srfi-34)
#:export (json-fetch
+ json->code
json->scheme-file))
(define* (json-fetch url
diff --git a/guix/scripts/import/json.scm b/guix/scripts/import/json.scm
index c9daf65479..778e5f4bc5 100644
--- a/guix/scripts/import/json.scm
+++ b/guix/scripts/import/json.scm
@@ -23,7 +23,7 @@
#:use-module (guix utils)
#:use-module (guix scripts)
#:use-module (guix import utils)
- #:use-module (guix import print)
+ #:use-module (guix import json)
#:use-module (guix scripts import)
#:use-module (guix packages)
#:use-module (srfi srfi-1)
@@ -88,14 +88,8 @@ Import and convert the JSON package definition in PACKAGE-FILE.\n"))
(reverse opts))))
(match args
((file-name)
- (catch 'json-invalid
- (lambda ()
- (let ((json (json-string->scm
- (with-input-from-file file-name read-string))))
- ;; TODO: also print define-module boilerplate
- (package->code (alist->package json))))
- (lambda _
- (leave (G_ "invalid JSON in file '~a'~%") file-name))))
+ (or (json->code file-name)
+ (leave (G_ "invalid JSON in file '~a'~%") file-name)))
(()
(leave (G_ "too few arguments~%")))
((many ...)
--
2.25.1
This bug report was last modified 5 years and 120 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.