Archived
1
0
Fork 0

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'.
This commit is contained in:
Ludovic Courtès 2014-09-06 23:30:28 +02:00
parent 1456cff18f
commit 49fa9381b8

View file

@ -68,6 +68,12 @@ initrd."
;; General Linux overview in `Documentation/early-userspace/README' and ;; General Linux overview in `Documentation/early-userspace/README' and
;; `Documentation/filesystems/ramfs-rootfs-initramfs.txt'. ;; `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)) (mlet %store-monad ((source (imported-modules modules))
(compiled (compiled-modules modules)) (compiled (compiled-modules modules))
(module-dir (flat-linux-module-directory linux (module-dir (flat-linux-module-directory linux
@ -77,6 +83,7 @@ initrd."
#~(begin #~(begin
(use-modules (gnu build linux-initrd) (use-modules (gnu build linux-initrd)
(guix build utils) (guix build utils)
(guix build store-copy)
(ice-9 pretty-print) (ice-9 pretty-print)
(ice-9 popen) (ice-9 popen)
(ice-9 match) (ice-9 match)
@ -98,6 +105,7 @@ initrd."
(effective-version)))) (effective-version))))
(mkdir #$output) (mkdir #$output)
(mkdir "contents") (mkdir "contents")
(with-directory-excursion "contents" (with-directory-excursion "contents"
(copy-recursively #$guile ".") (copy-recursively #$guile ".")
(call-with-output-file "init" (call-with-output-file "init"
@ -127,17 +135,9 @@ initrd."
(mkdir "modules") (mkdir "modules")
(copy-recursively #$module-dir "modules") (copy-recursively #$module-dir "modules")
(let ((store #$(string-append "." (%store-prefix))) ;; Populate the initrd's store.
(to-copy '#$to-copy)) (with-directory-excursion ".."
(unless (null? to-copy) (populate-store '#$graph-files "contents"))
(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))
;; Reset the timestamps of all the files that will make it in the ;; Reset the timestamps of all the files that will make it in the
;; initrd. ;; initrd.
@ -150,7 +150,9 @@ initrd."
(gexp->derivation name builder (gexp->derivation name builder
#:modules '((guix build utils) #: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) (define (flat-linux-module-directory linux modules)
"Return a flat directory containing the Linux kernel modules listed in "Return a flat directory containing the Linux kernel modules listed in