From d422cbb3d6a1cc7e4553a2335b113475a05d68ad Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 21 Nov 2018 16:19:09 +0100 Subject: linux-initrd: 'expression->initrd' returns the complete file name. Previously 'expression->initrd' would return the directory that contains the 'initrd' file; now it returns the complete file name for that file. * gnu/system/linux-initrd.scm (expression->initrd)[builder]: Change output file name to "initrd.cpio.gz". Tail-call 'file-append' to return the complete file name. * gnu/system.scm (operating-system-initrd-file): Remove 'file-append' call. * gnu/build/linux-initrd.scm (write-cpio-archive): Check whether OUTPUT already has the ".gz" suffix; rename if before invoking GZIP if it does, and otherwise after. * gnu/system/vm.scm (expression->derivation-in-linux-vm)[builder]: Do not append "/initrd" to #$initrd. --- gnu/build/linux-initrd.scm | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'gnu/build/linux-initrd.scm') 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) -- cgit v1.2.3