pack: Use 'with-extensions' when referring to (guix docker).

* guix/docker.scm: Use module (json) the normal way.
* guix/scripts/pack.scm (docker-image)[build]: Wrap in
'with-extensions'.
This commit is contained in:
Ludovic Courtès 2018-05-28 18:22:24 +02:00
parent 838e17d805
commit 13993c77fe
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 19 additions and 24 deletions

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com> ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -26,6 +26,7 @@
delete-file-recursively delete-file-recursively
with-directory-excursion with-directory-excursion
invoke)) invoke))
#:use-module (json) ;guile-json
#:use-module (srfi srfi-19) #:use-module (srfi srfi-19)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module ((texinfo string-utils) #:use-module ((texinfo string-utils)
@ -34,9 +35,6 @@
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:export (build-docker-image)) #:export (build-docker-image))
;; Load Guile-JSON at run time to simplify the job of 'imported-modules' & co.
(module-use! (current-module) (resolve-interface '(json)))
;; Generate a 256-bit identifier in hexadecimal encoding for the Docker image. ;; Generate a 256-bit identifier in hexadecimal encoding for the Docker image.
(define docker-id (define docker-id
(compose bytevector->base16-string sha256 string->utf8)) (compose bytevector->base16-string sha256 string->utf8))

View File

@ -340,28 +340,25 @@ the image."
guile-json)) guile-json))
(define build (define build
(with-imported-modules `(,@(source-module-closure '((guix docker)) ;; Guile-JSON is required by (guix docker).
#:select? not-config?) (with-extensions (list json)
(guix build store-copy) (with-imported-modules `(,@(source-module-closure '((guix docker))
((guix config) => ,config)) #:select? not-config?)
#~(begin (guix build store-copy)
;; Guile-JSON is required by (guix docker). ((guix config) => ,config))
(add-to-load-path #~(begin
(string-append #+json "/share/guile/site/" (use-modules (guix docker) (srfi srfi-19) (guix build store-copy))
(effective-version)))
(use-modules (guix docker) (srfi srfi-19) (guix build store-copy)) (setenv "PATH" (string-append #$archiver "/bin"))
(setenv "PATH" (string-append #$archiver "/bin")) (build-docker-image #$output
(call-with-input-file "profile"
(build-docker-image #$output read-reference-graph)
(call-with-input-file "profile" #$profile
read-reference-graph) #:system (or #$target (utsname:machine (uname)))
#$profile #:symlinks '#$symlinks
#:system (or #$target (utsname:machine (uname))) #:compressor '#$(compressor-command compressor)
#:symlinks '#$symlinks #:creation-time (make-time time-utc 0 1))))))
#:compressor '#$(compressor-command compressor)
#:creation-time (make-time time-utc 0 1)))))
(gexp->derivation (string-append name ".tar" (gexp->derivation (string-append name ".tar"
(compressor-extension compressor)) (compressor-extension compressor))