summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-11-22 00:10:44 +0100
committerMarius Bakke <mbakke@fastmail.com>2018-11-22 00:10:44 +0100
commitec8130eb23b79c2b8b61043f25dafcefd0daafe7 (patch)
tree4a2f05d13900ee0ea61753d85d0727630b4e22e8 /gnu/build
parent437c78bcfb268fe9d4e6116b2eb083ed873215f4 (diff)
parentd422cbb3d6a1cc7e4553a2335b113475a05d68ad (diff)
downloadguix-ec8130eb23b79c2b8b61043f25dafcefd0daafe7.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/linux-initrd.scm22
1 files changed, 17 insertions, 5 deletions
diff --git a/gnu/build/linux-initrd.scm b/gnu/build/linux-initrd.scm
index fb8a1f5b2b..3aaa06d3a0 100644
--- a/gnu/build/linux-initrd.scm
+++ b/gnu/build/linux-initrd.scm
@@ -72,11 +72,23 @@ COMPRESS? is true, compress it using GZIP.  On success, return OUTPUT."
                                #:file->header cpio:file->cpio-header*)))
 
   (or (not compress?)
-      ;; Use '--no-name' so that gzip records neither a file name nor a time
-      ;; stamp in its output.
-      (and (zero? (system* gzip "--best" "--no-name" output))
-           (rename-file (string-append output ".gz")
-                        output))
+
+      ;; Gzip insists on adding a '.gz' suffix and does nothing if the input
+      ;; file already has that suffix.  Shuffle files around to placate it.
+      (let* ((gz-suffix? (string-suffix? ".gz" output))
+             (sans-gz    (if gz-suffix?
+                             (string-drop-right output 3)
+                             output)))
+        (when gz-suffix?
+          (rename-file output sans-gz))
+        ;; Use '--no-name' so that gzip records neither a file name nor a time
+        ;; stamp in its output.
+        (and (zero? (system* gzip "--best" "--no-name" sans-gz))
+             (begin
+               (unless gz-suffix?
+                 (rename-file (string-append output ".gz") output))
+               output)))
+
       output))
 
 (define (cache-compiled-file-name file)