unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 31633@debbugs.gnu.org
Subject: [bug#31633] [PATCH 2/7] pack: Use 'with-extensions' when referring to (guix docker).
Date: Mon, 28 May 2018 23:59:25 +0200	[thread overview]
Message-ID: <20180528215930.23621-2-ludo@gnu.org> (raw)
In-Reply-To: <20180528215930.23621-1-ludo@gnu.org>

* guix/docker.scm: Use module (json) the normal way.
* guix/scripts/pack.scm (docker-image)[build]: Wrap in
'with-extensions'.
---
 guix/docker.scm       |  6 ++----
 guix/scripts/pack.scm | 37 +++++++++++++++++--------------------
 2 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/guix/docker.scm b/guix/docker.scm
index a75534c33..b86990159 100644
--- a/guix/docker.scm
+++ b/guix/docker.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; 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>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -26,6 +26,7 @@
                           delete-file-recursively
                           with-directory-excursion
                           invoke))
+  #:use-module (json)                             ;guile-json
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module ((texinfo string-utils)
@@ -34,9 +35,6 @@
   #:use-module (ice-9 match)
   #: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.
 (define docker-id
   (compose bytevector->base16-string sha256 string->utf8))
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 1e84459e7..f5e247ed7 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -256,28 +256,25 @@ the image."
         guile-json))
 
   (define build
-    (with-imported-modules `(,@(source-module-closure '((guix docker))
-                                                      #:select? not-config?)
-                             (guix build store-copy)
-                             ((guix config) => ,config))
-      #~(begin
-          ;; Guile-JSON is required by (guix docker).
-          (add-to-load-path
-           (string-append #+json "/share/guile/site/"
-                          (effective-version)))
+    ;; Guile-JSON is required by (guix docker).
+    (with-extensions (list json)
+      (with-imported-modules `(,@(source-module-closure '((guix docker))
+                                                        #:select? not-config?)
+                               (guix build store-copy)
+                               ((guix config) => ,config))
+        #~(begin
+            (use-modules (guix docker) (srfi srfi-19) (guix build store-copy))
 
-          (use-modules (guix docker) (srfi srfi-19) (guix build store-copy))
+            (setenv "PATH" (string-append #$tar "/bin"))
 
-          (setenv "PATH" (string-append #$tar "/bin"))
-
-          (build-docker-image #$output
-                              (call-with-input-file "profile"
-                                read-reference-graph)
-                              #$profile
-                              #:system (or #$target (utsname:machine (uname)))
-                              #:symlinks '#$symlinks
-                              #:compressor '#$(compressor-command compressor)
-                              #:creation-time (make-time time-utc 0 1)))))
+            (build-docker-image #$output
+                                (call-with-input-file "profile"
+                                  read-reference-graph)
+                                #$profile
+                                #:system (or #$target (utsname:machine (uname)))
+                                #:symlinks '#$symlinks
+                                #:compressor '#$(compressor-command compressor)
+                                #:creation-time (make-time time-utc 0 1))))))
 
   (gexp->derivation (string-append name ".tar"
                                    (compressor-extension compressor))
-- 
2.17.0

  reply	other threads:[~2018-05-28 22:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 21:56 [bug#31633] [PATCH 0/7] Add 'with-extensions' for gexps Ludovic Courtès
2018-05-28 21:59 ` [bug#31633] [PATCH 1/7] gexp: Add 'with-extensions' Ludovic Courtès
2018-05-28 21:59   ` Ludovic Courtès [this message]
2018-05-28 21:59   ` [bug#31633] [PATCH 3/7] tests: ssh: Use 'with-extensions' Ludovic Courtès
2018-05-28 21:59   ` [bug#31633] [PATCH 4/7] bootloader: grub: Simplify 'svg->png' Ludovic Courtès
2018-05-28 21:59   ` [bug#31633] [PATCH 5/7] bootloader: grub: Use 'with-extensions' Ludovic Courtès
2018-05-28 21:59   ` [bug#31633] [PATCH 6/7] profiles: " Ludovic Courtès
2018-05-28 21:59   ` [bug#31633] [PATCH 7/7] vm: " Ludovic Courtès
2018-06-01  7:37 ` [bug#31633] [PATCH 0/7] Add 'with-extensions' for gexps Danny Milosavljevic
2018-06-01 13:42   ` bug#31633: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180528215930.23621-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=31633@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).