Remove (guix json) and require Guile-JSON 4.3.0+.
This is a followup to 4071879c86
.
* guix/json.scm: Remove.
* Makefile.am (MODULES): Adjust accordingly.
* m4/guix.m4 (GUIX_CHECK_GUILE_JSON): Check for 'define-json-mapping'.
* doc/guix.texi (Requirements): Require Guile-JSON 4.3.0+.
* guix/ci.scm, guix/cve.scm, guix/import/cpan.scm,
guix/import/crate.scm, guix/swh.scm: Remove (guix json) import.
* guix/import/gem.scm, guix/import/pypi.scm: Likewise, and import (json).
* guix/self.scm (specification->package): Switch to GUILE-JSON-4.
* guix/git-download.scm (git-fetch): Likewise.
master
parent
d15c7974a2
commit
b5eb901ab5
|
@ -68,7 +68,6 @@ MODULES = \
|
||||||
guix/cpio.scm \
|
guix/cpio.scm \
|
||||||
guix/deprecation.scm \
|
guix/deprecation.scm \
|
||||||
guix/docker.scm \
|
guix/docker.scm \
|
||||||
guix/json.scm \
|
|
||||||
guix/records.scm \
|
guix/records.scm \
|
||||||
guix/openpgp.scm \
|
guix/openpgp.scm \
|
||||||
guix/pki.scm \
|
guix/pki.scm \
|
||||||
|
|
|
@ -790,7 +790,8 @@ or later;
|
||||||
@c FIXME: Specify a version number once a release has been made.
|
@c FIXME: Specify a version number once a release has been made.
|
||||||
@uref{https://gitlab.com/guile-git/guile-git, Guile-Git}, from August
|
@uref{https://gitlab.com/guile-git/guile-git, Guile-Git}, from August
|
||||||
2017 or later;
|
2017 or later;
|
||||||
@item @uref{https://savannah.nongnu.org/projects/guile-json/, Guile-JSON} 3.x;
|
@item @uref{https://savannah.nongnu.org/projects/guile-json/,
|
||||||
|
Guile-JSON} 4.3.0 or later;
|
||||||
@item @url{https://www.gnu.org/software/make/, GNU Make}.
|
@item @url{https://www.gnu.org/software/make/, GNU Make}.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
(define-module (guix ci)
|
(define-module (guix ci)
|
||||||
#:use-module (guix http-client)
|
#:use-module (guix http-client)
|
||||||
#:use-module (guix json)
|
|
||||||
#:use-module (json)
|
#:use-module (json)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
(define-module (guix cve)
|
(define-module (guix cve)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module (guix http-client)
|
#:use-module (guix http-client)
|
||||||
#:use-module (guix json)
|
|
||||||
#:use-module (guix i18n)
|
#:use-module (guix i18n)
|
||||||
#:use-module ((guix diagnostics) #:select (formatted-message))
|
#:use-module ((guix diagnostics) #:select (formatted-message))
|
||||||
#:use-module (json)
|
#:use-module (json)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2017 Mathieu Lirzin <mthl@gnu.org>
|
;;; Copyright © 2017 Mathieu Lirzin <mthl@gnu.org>
|
||||||
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
|
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
|
||||||
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
||||||
|
@ -85,7 +85,7 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
|
||||||
'tar)))))
|
'tar)))))
|
||||||
|
|
||||||
(define guile-json
|
(define guile-json
|
||||||
(module-ref (resolve-interface '(gnu packages guile)) 'guile-json-3))
|
(module-ref (resolve-interface '(gnu packages guile)) 'guile-json-4))
|
||||||
|
|
||||||
(define guile-zlib
|
(define guile-zlib
|
||||||
(module-ref (resolve-interface '(gnu packages guile)) 'guile-zlib))
|
(module-ref (resolve-interface '(gnu packages guile)) 'guile-zlib))
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (json)
|
#:use-module (json)
|
||||||
#:use-module (guix json)
|
|
||||||
#:use-module (gcrypt hash)
|
#:use-module (gcrypt hash)
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#:use-module ((guix download) #:prefix download:)
|
#:use-module ((guix download) #:prefix download:)
|
||||||
#:use-module (gcrypt hash)
|
#:use-module (gcrypt hash)
|
||||||
#:use-module (guix http-client)
|
#:use-module (guix http-client)
|
||||||
#:use-module (guix json)
|
|
||||||
#:use-module (guix import json)
|
#:use-module (guix import json)
|
||||||
#:use-module (guix import utils)
|
#:use-module (guix import utils)
|
||||||
#:use-module ((guix licenses) #:prefix license:)
|
#:use-module ((guix licenses) #:prefix license:)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
(define-module (guix import gem)
|
(define-module (guix import gem)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (guix json)
|
#:use-module (json)
|
||||||
#:use-module ((guix download) #:prefix download:)
|
#:use-module ((guix download) #:prefix download:)
|
||||||
#:use-module (guix import utils)
|
#:use-module (guix import utils)
|
||||||
#:use-module (guix import json)
|
#:use-module (guix import json)
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#:use-module (guix import utils)
|
#:use-module (guix import utils)
|
||||||
#:use-module ((guix download) #:prefix download:)
|
#:use-module ((guix download) #:prefix download:)
|
||||||
#:use-module (guix import json)
|
#:use-module (guix import json)
|
||||||
#:use-module (guix json)
|
#:use-module (json)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix upstream)
|
#:use-module (guix upstream)
|
||||||
#:use-module ((guix licenses) #:prefix license:)
|
#:use-module ((guix licenses) #:prefix license:)
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
|
||||||
;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
|
||||||
;;;
|
|
||||||
;;; This file is part of GNU Guix.
|
|
||||||
;;;
|
|
||||||
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
||||||
;;; under the terms of the GNU General Public License as published by
|
|
||||||
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
||||||
;;; your option) any later version.
|
|
||||||
;;;
|
|
||||||
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
||||||
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;;; GNU General Public License for more details.
|
|
||||||
;;;
|
|
||||||
;;; You should have received a copy of the GNU General Public License
|
|
||||||
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
(define-module (guix json)
|
|
||||||
#:use-module (json)
|
|
||||||
#:use-module (srfi srfi-9))
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
;;;
|
|
||||||
;;; Helpers to map JSON objects to SRFI-9 records. Taken from (guix swh).
|
|
||||||
;;; This module is superseded by 'define-json-mapping' as found since version
|
|
||||||
;;; 4.2.0 of Guile-JSON and will be removed once migration is complete.
|
|
||||||
;;;
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(define-syntax define-as-needed
|
|
||||||
(lambda (s)
|
|
||||||
"Define the given syntax rule unless (json) already provides it."
|
|
||||||
(syntax-case s ()
|
|
||||||
((_ (macro args ...) body ...)
|
|
||||||
(if (module-defined? (resolve-interface '(json))
|
|
||||||
(syntax->datum #'macro))
|
|
||||||
#'(eval-when (expand load eval)
|
|
||||||
;; Re-export MACRO from (json).
|
|
||||||
(module-re-export! (current-module) '(macro)))
|
|
||||||
#'(begin
|
|
||||||
;; Using Guile-JSON < 4.2.0, so provide our own MACRO.
|
|
||||||
(define-syntax-rule (macro args ...)
|
|
||||||
body ...)
|
|
||||||
(eval-when (expand load eval)
|
|
||||||
(module-export! (current-module) '(macro)))))))))
|
|
||||||
|
|
||||||
(define-syntax-rule (define-json-reader json->record ctor spec ...)
|
|
||||||
"Define JSON->RECORD as a procedure that converts a JSON representation,
|
|
||||||
read from a port, string, or hash table, into a record created by CTOR and
|
|
||||||
following SPEC, a series of field specifications."
|
|
||||||
(define (json->record input)
|
|
||||||
(let ((table (cond ((port? input)
|
|
||||||
(json->scm input))
|
|
||||||
((string? input)
|
|
||||||
(json-string->scm input))
|
|
||||||
((or (null? input) (pair? input))
|
|
||||||
input))))
|
|
||||||
(let-syntax ((extract-field (syntax-rules ()
|
|
||||||
((_ table (field key json->value))
|
|
||||||
(json->value (assoc-ref table key)))
|
|
||||||
((_ table (field key))
|
|
||||||
(assoc-ref table key))
|
|
||||||
((_ table (field))
|
|
||||||
(assoc-ref table
|
|
||||||
(symbol->string 'field))))))
|
|
||||||
(ctor (extract-field table spec) ...)))))
|
|
||||||
|
|
||||||
;; For some reason we cannot just have colliding definitions of
|
|
||||||
;; 'define-json-mapping' (that leads to a build failure in users of this
|
|
||||||
;; module), hence the use of 'define-as-needed'.
|
|
||||||
(define-as-needed (define-json-mapping rtd ctor pred json->record
|
|
||||||
(field getter spec ...) ...)
|
|
||||||
"Define RTD as a record type with the given FIELDs and GETTERs, à la SRFI-9,
|
|
||||||
and define JSON->RECORD as a conversion from JSON to a record of this type."
|
|
||||||
(begin
|
|
||||||
(define-record-type rtd
|
|
||||||
(ctor field ...)
|
|
||||||
pred
|
|
||||||
(field getter) ...)
|
|
||||||
|
|
||||||
(define-json-reader json->record ctor
|
|
||||||
(field spec ...) ...)))
|
|
|
@ -49,7 +49,7 @@
|
||||||
(module-ref (resolve-interface module) variable))))
|
(module-ref (resolve-interface module) variable))))
|
||||||
(match-lambda
|
(match-lambda
|
||||||
("guile" (ref '(gnu packages guile) 'guile-3.0/libgc-7))
|
("guile" (ref '(gnu packages guile) 'guile-3.0/libgc-7))
|
||||||
("guile-json" (ref '(gnu packages guile) 'guile-json-3))
|
("guile-json" (ref '(gnu packages guile) 'guile-json-4))
|
||||||
("guile-ssh" (ref '(gnu packages ssh) 'guile-ssh))
|
("guile-ssh" (ref '(gnu packages ssh) 'guile-ssh))
|
||||||
("guile-git" (ref '(gnu packages guile) 'guile-git))
|
("guile-git" (ref '(gnu packages guile) 'guile-git))
|
||||||
("guile-sqlite3" (ref '(gnu packages guile) 'guile-sqlite3))
|
("guile-sqlite3" (ref '(gnu packages guile) 'guile-sqlite3))
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#:use-module (guix build utils)
|
#:use-module (guix build utils)
|
||||||
#:use-module ((guix build syscalls) #:select (mkdtemp!))
|
#:use-module ((guix build syscalls) #:select (mkdtemp!))
|
||||||
#:use-module (web uri)
|
#:use-module (web uri)
|
||||||
#:use-module (guix json)
|
|
||||||
#:use-module (web client)
|
#:use-module (web client)
|
||||||
#:use-module (web response)
|
#:use-module (web response)
|
||||||
#:use-module (json)
|
#:use-module (json)
|
||||||
|
|
19
m4/guix.m4
19
m4/guix.m4
|
@ -161,14 +161,23 @@ dnl GUIX_CHECK_GUILE_JSON
|
||||||
dnl
|
dnl
|
||||||
dnl Check whether a recent-enough Guile-JSON is available.
|
dnl Check whether a recent-enough Guile-JSON is available.
|
||||||
AC_DEFUN([GUIX_CHECK_GUILE_JSON], [
|
AC_DEFUN([GUIX_CHECK_GUILE_JSON], [
|
||||||
dnl Check whether we're using Guile-JSON 3.x, which uses a JSON-to-Scheme
|
dnl Check whether we're using Guile-JSON 4.3+, which provides
|
||||||
dnl mapping different from that of earlier versions.
|
dnl 'define-json-mapping'.
|
||||||
AC_CACHE_CHECK([whether Guile-JSON is available and recent enough],
|
AC_CACHE_CHECK([whether Guile-JSON is available and recent enough],
|
||||||
[guix_cv_have_recent_guile_json],
|
[guix_cv_have_recent_guile_json],
|
||||||
[GUILE_CHECK([retval],
|
[GUILE_CHECK([retval],
|
||||||
[(use-modules (json) (ice-9 match))
|
[(use-modules (json))
|
||||||
(match (json-string->scm \"[[ { \\\"a\\\": 42 } ]]\")
|
|
||||||
(#((("a" . 42))) #t))])
|
(define-json-mapping <frob> make-frob
|
||||||
|
frob?
|
||||||
|
json->frob
|
||||||
|
(a frob-a)
|
||||||
|
(b frob-b \"bee\"))
|
||||||
|
|
||||||
|
(exit
|
||||||
|
(equal? (json->frob
|
||||||
|
(open-input-string \"{ \\\"a\\\": 1, \\\"bee\\\": 2 }\"))
|
||||||
|
(make-frob 1 2)))])
|
||||||
if test "$retval" = 0; then
|
if test "$retval" = 0; then
|
||||||
guix_cv_have_recent_guile_json="yes"
|
guix_cv_have_recent_guile_json="yes"
|
||||||
else
|
else
|
||||||
|
|
Reference in New Issue