[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/06: pack: Move absolute file name to <compressor>.

From: Ludovic Courtès
Subject: 01/06: pack: Move absolute file name to <compressor>.
Date: Fri, 17 Mar 2017 19:42:31 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 48b444304e206c35cf2c8e0d87a4711f1aac4fd4
Author: Ludovic Courtès <address@hidden>
Date:   Fri Mar 17 17:37:00 2017 +0100

    pack: Move absolute file name to <compressor>.
    * guix/scripts/pack.scm (<compressor>)[package]: Remove.
    [command]: Document as being a gexp with an absolute file name.
    (%compressors): Adjust accordingly.
    (self-contained-tarball): Simplify PATH expression.  Move 'string-join'
    for the compressor command on the build side.
    (docker-image): Simplify PATH expression.
    * tests/pack.scm (%gzip-compressor): Adjust accordingly.
 guix/scripts/pack.scm | 31 ++++++++++++++++---------------
 tests/pack.scm        |  3 ++-
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 74d4ee6..ce7613e 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -46,19 +46,22 @@
 ;; Type of a compression tool.
 (define-record-type <compressor>
-  (compressor name package extension command)
+  (compressor name extension command)
-  (name       compressor-name)                    ;string (e.g., "gzip")
-  (package    compressor-package)                 ;package
-  (extension  compressor-extension)               ;string (e.g., "lz")
-  (command    compressor-command))                ;list (e.g., '("gzip" "-9n"))
+  (name       compressor-name)      ;string (e.g., "gzip")
+  (extension  compressor-extension) ;string (e.g., "lz")
+  (command    compressor-command))  ;gexp (e.g., #~("/gnu/store/…/gzip" "-9n"))
 (define %compressors
   ;; Available compression tools.
-  (list (compressor "gzip"  gzip  "gz"  '("gzip" "-9n"))
-        (compressor "lzip"  lzip  "lz"  '("lzip" "-9"))
-        (compressor "xz"    xz    "xz"  '("xz" "-e"))
-        (compressor "bzip2" bzip2 "bz2" '("bzip2" "-9"))))
+  (list (compressor "gzip"  "gz"
+                    #~(#+(file-append gzip "/bin/gzip") "-9n"))
+        (compressor "lzip"  "lz"
+                    #~(#+(file-append lzip "/bin/lzip") "-9"))
+        (compressor "xz"    "xz"
+                    #~(#+(file-append xz "/bin/xz") "-e"))
+        (compressor "bzip2" "bz2"
+                    #~(#+(file-append bzip2 "/bin/bzip2") "-9"))))
 (define (lookup-compressor name)
   "Return the compressor object called NAME.  Error out if it could not be
@@ -121,8 +124,7 @@ added to the pack."
                   (string-append #$(if localstatedir?
                                        (file-append guix "/sbin:")
-                                 #$tar "/bin:"
-                                 #$(compressor-package compressor) "/bin"))
+                                 #$tar "/bin"))
           ;; Note: there is not much to gain here with deduplication and
           ;; there is the overhead of the '.links' directory, so turn it
@@ -142,7 +144,8 @@ added to the pack."
           (with-directory-excursion %root
              (zero? (apply system* "tar"
-                           "-I" #$(string-join (compressor-command compressor))
+                           "-I"
+                           (string-join '#+(compressor-command compressor))
                            ;; Avoid non-determinism in the archive.  Use
@@ -221,9 +224,7 @@ with COMPRESSOR.  It can be passed to 'docker load'."
           (use-modules (guix docker) (srfi srfi-19))
-          (setenv "PATH"
-                  (string-append #$tar "/bin:"
-                                 #$(compressor-package compressor) "/bin"))
+          (setenv "PATH" (string-append #$tar "/bin"))
           (build-docker-image #$output #$profile
                               #:closure "profile"
diff --git a/tests/pack.scm b/tests/pack.scm
index de9ef8e..eb643c3 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -42,7 +42,8 @@
 (define %gzip-compressor
   ;; Compressor that uses the bootstrap 'gzip'.
   ((@ (guix scripts pack) compressor) "gzip"
-   %bootstrap-coreutils&co "gz" '("gzip" "-6n")))
+   "gz"
+   #~(#+(file-append %bootstrap-coreutils&co "/bin/gzip") "-6n")))
 (define %tar-bootstrap %bootstrap-coreutils&co)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]