summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/scripts/pack.scm31
-rw-r--r--tests/pack.scm3
2 files changed, 18 insertions, 16 deletions
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 74d4ee6d4da..ce7613e4a01 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -46,19 +46,22 @@
46 46
47;; Type of a compression tool. 47;; Type of a compression tool.
48(define-record-type <compressor> 48(define-record-type <compressor>
49 (compressor name package extension command) 49 (compressor name extension command)
50 compressor? 50 compressor?
51 (name compressor-name) ;string (e.g., "gzip") 51 (name compressor-name) ;string (e.g., "gzip")
52 (package compressor-package) ;package 52 (extension compressor-extension) ;string (e.g., "lz")
53 (extension compressor-extension) ;string (e.g., "lz") 53 (command compressor-command)) ;gexp (e.g., #~("/gnu/store/…/gzip" "-9n"))
54 (command compressor-command)) ;list (e.g., '("gzip" "-9n"))
55 54
56(define %compressors 55(define %compressors
57 ;; Available compression tools. 56 ;; Available compression tools.
58 (list (compressor "gzip" gzip "gz" '("gzip" "-9n")) 57 (list (compressor "gzip" "gz"
59 (compressor "lzip" lzip "lz" '("lzip" "-9")) 58 #~(#+(file-append gzip "/bin/gzip") "-9n"))
60 (compressor "xz" xz "xz" '("xz" "-e")) 59 (compressor "lzip" "lz"
61 (compressor "bzip2" bzip2 "bz2" '("bzip2" "-9")))) 60 #~(#+(file-append lzip "/bin/lzip") "-9"))
61 (compressor "xz" "xz"
62 #~(#+(file-append xz "/bin/xz") "-e"))
63 (compressor "bzip2" "bz2"
64 #~(#+(file-append bzip2 "/bin/bzip2") "-9"))))
62 65
63(define (lookup-compressor name) 66(define (lookup-compressor name)
64 "Return the compressor object called NAME. Error out if it could not be 67 "Return the compressor object called NAME. Error out if it could not be
@@ -121,8 +124,7 @@ added to the pack."
121 (string-append #$(if localstatedir? 124 (string-append #$(if localstatedir?
122 (file-append guix "/sbin:") 125 (file-append guix "/sbin:")
123 "") 126 "")
124 #$tar "/bin:" 127 #$tar "/bin"))
125 #$(compressor-package compressor) "/bin"))
126 128
127 ;; Note: there is not much to gain here with deduplication and 129 ;; Note: there is not much to gain here with deduplication and
128 ;; there is the overhead of the '.links' directory, so turn it 130 ;; there is the overhead of the '.links' directory, so turn it
@@ -142,7 +144,8 @@ added to the pack."
142 (with-directory-excursion %root 144 (with-directory-excursion %root
143 (exit 145 (exit
144 (zero? (apply system* "tar" 146 (zero? (apply system* "tar"
145 "-I" #$(string-join (compressor-command compressor)) 147 "-I"
148 (string-join '#+(compressor-command compressor))
146 "--format=gnu" 149 "--format=gnu"
147 150
148 ;; Avoid non-determinism in the archive. Use 151 ;; Avoid non-determinism in the archive. Use
@@ -221,9 +224,7 @@ with COMPRESSOR. It can be passed to 'docker load'."
221 224
222 (use-modules (guix docker) (srfi srfi-19)) 225 (use-modules (guix docker) (srfi srfi-19))
223 226
224 (setenv "PATH" 227 (setenv "PATH" (string-append #$tar "/bin"))
225 (string-append #$tar "/bin:"
226 #$(compressor-package compressor) "/bin"))
227 228
228 (build-docker-image #$output #$profile 229 (build-docker-image #$output #$profile
229 #:closure "profile" 230 #:closure "profile"
diff --git a/tests/pack.scm b/tests/pack.scm
index de9ef8e6ab3..eb643c3229f 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -42,7 +42,8 @@
42(define %gzip-compressor 42(define %gzip-compressor
43 ;; Compressor that uses the bootstrap 'gzip'. 43 ;; Compressor that uses the bootstrap 'gzip'.
44 ((@ (guix scripts pack) compressor) "gzip" 44 ((@ (guix scripts pack) compressor) "gzip"
45 %bootstrap-coreutils&co "gz" '("gzip" "-6n"))) 45 "gz"
46 #~(#+(file-append %bootstrap-coreutils&co "/bin/gzip") "-6n")))
46 47
47(define %tar-bootstrap %bootstrap-coreutils&co) 48(define %tar-bootstrap %bootstrap-coreutils&co)
48 49