aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-06 23:30:28 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-06 23:42:56 +0200
commit49fa9381b8767c937e80d43f3d1cb0a83690ea1f (patch)
treef389981a7cdf2bd2f05aa115667e3e80db22675b
parent1456cff18fa38c57729fd3d91c200a113cbaed59 (diff)
downloadguix-49fa9381b8767c937e80d43f3d1cb0a83690ea1f.tar.gz
guix-49fa9381b8767c937e80d43f3d1cb0a83690ea1f.zip
linux-initrd: Populate the initrd's store with complete closures.
* gnu/system/linux-initrd.scm (expression->initrd): Add 'graph-files'. Use (guix build store-copy) and 'populate-store' instead of local hack. Pass #:references-graphs to 'gexp->derivation'.
-rw-r--r--gnu/system/linux-initrd.scm26
1 files changed, 14 insertions, 12 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 1108bec51d..627d17bac2 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -68,6 +68,12 @@ initrd."
;; General Linux overview in `Documentation/early-userspace/README' and
;; `Documentation/filesystems/ramfs-rootfs-initramfs.txt'.
+ (define graph-files
+ (unfold-right zero?
+ number->string
+ 1-
+ (length to-copy)))
+
(mlet %store-monad ((source (imported-modules modules))
(compiled (compiled-modules modules))
(module-dir (flat-linux-module-directory linux
@@ -77,6 +83,7 @@ initrd."
#~(begin
(use-modules (gnu build linux-initrd)
(guix build utils)
+ (guix build store-copy)
(ice-9 pretty-print)
(ice-9 popen)
(ice-9 match)
@@ -98,6 +105,7 @@ initrd."
(effective-version))))
(mkdir #$output)
(mkdir "contents")
+
(with-directory-excursion "contents"
(copy-recursively #$guile ".")
(call-with-output-file "init"
@@ -127,17 +135,9 @@ initrd."
(mkdir "modules")
(copy-recursively #$module-dir "modules")
- (let ((store #$(string-append "." (%store-prefix)))
- (to-copy '#$to-copy))
- (unless (null? to-copy)
- (mkdir-p store))
- ;; XXX: Should we do export-references-graph?
- (for-each (lambda (input)
- (let ((target
- (string-append store "/"
- (basename input))))
- (copy-recursively input target)))
- to-copy))
+ ;; Populate the initrd's store.
+ (with-directory-excursion ".."
+ (populate-store '#$graph-files "contents"))
;; Reset the timestamps of all the files that will make it in the
;; initrd.
@@ -150,7 +150,9 @@ initrd."
(gexp->derivation name builder
#:modules '((guix build utils)
- (gnu build linux-initrd)))))
+ (guix build store-copy)
+ (gnu build linux-initrd))
+ #:references-graphs (zip graph-files to-copy))))
(define (flat-linux-module-directory linux modules)
"Return a flat directory containing the Linux kernel modules listed in