aboutsummaryrefslogtreecommitdiff
path: root/guix/docker.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-03-17 22:45:32 +0100
committerLudovic Courtès <ludo@gnu.org>2017-03-18 00:38:41 +0100
commit5461115e8fd9a3181506307b6090716a0d5c202c (patch)
treef061b60d6eb89dc6e6cfe3fc1fc58430e64a79f2 /guix/docker.scm
parent176febe3776b272dffbe757414225702d08c3bdf (diff)
downloadgnu-guix-5461115e8fd9a3181506307b6090716a0d5c202c.tar
gnu-guix-5461115e8fd9a3181506307b6090716a0d5c202c.tar.gz
pack: Add '--target'.
* guix/scripts/pack.scm (self-contained-tarball): Add #:target. (docker-image): Add #:target. [build]: Pass it to 'build-docker-image'. (%options, show-help): Add '--target'. (guix-pack): Pass TARGET to 'profile-derivation' and to 'build-image'. * guix/docker.scm (build-docker-image): Add #:system parameter and honor it. * doc/guix.texi (Invoking guix pack): Document '--target'. (Additional Build Options): Refer to the Autoconf manual instead of the obsolete 'configure.info' for cross-compilation.
Diffstat (limited to 'guix/docker.scm')
-rw-r--r--guix/docker.scm21
1 files changed, 15 insertions, 6 deletions
diff --git a/guix/docker.scm b/guix/docker.scm
index 290ad3dcf1..060232148e 100644
--- a/guix/docker.scm
+++ b/guix/docker.scm
@@ -105,12 +105,14 @@ return \"a\"."
(define* (build-docker-image image path
#:key closure compressor
(symlinks '())
+ (system (utsname:machine (uname)))
(creation-time (current-time time-utc)))
"Write to IMAGE a Docker image archive from the given store PATH. The image
contains the closure of PATH, as specified in CLOSURE (a file produced by
#:references-graphs). SYMLINKS must be a list of (SOURCE -> TARGET) tuples
describing symlinks to be created in the image, where each TARGET is relative
-to PATH.
+to PATH. SYSTEM is a GNU triplet (or prefix thereof) of the system the
+binaries at PATH are for; it is used to produce metadata in the image.
Use COMPRESSOR, a command such as '(\"gzip\" \"-9n\"), to compress IMAGE. Use
CREATION-TIME, a SRFI-19 time-utc object, as the creation time in metadata."
@@ -118,11 +120,18 @@ CREATION-TIME, a SRFI-19 time-utc object, as the creation time in metadata."
(closure (canonicalize-path closure))
(id (docker-id path))
(time (date->string (time-utc->date creation-time) "~4"))
- (arch (match (utsname:machine (uname))
- ("x86_64" "amd64")
- ("i686" "386")
- ("armv7l" "arm")
- ("mips64" "mips64le"))))
+ (arch (let-syntax ((cond* (syntax-rules ()
+ ((_ (pattern clause) ...)
+ (cond ((string-prefix? pattern system)
+ clause)
+ ...
+ (else
+ (error "unsupported system"
+ system)))))))
+ (cond* ("x86_64" "amd64")
+ ("i686" "386")
+ ("arm" "arm")
+ ("mips64" "mips64le")))))
;; Make sure we start with a fresh, empty working directory.
(mkdir directory)