summaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-07-18 21:38:16 +0200
committerLudovic Courtès <ludo@gnu.org>2017-07-18 21:41:35 +0200
commit8d033e3e1607d5722ef7288208551d0331c8a853 (patch)
tree99ef8e9d5b492ab35516489d6b35211f15cc3dea /gnu/build
parent45c18f8529ed25729e9cbdfeeda4aed3c965180d (diff)
downloadpatches-8d033e3e1607d5722ef7288208551d0331c8a853.tar
patches-8d033e3e1607d5722ef7288208551d0331c8a853.tar.gz
vm: 'iso9660-image' produces a single-file output.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add #:single-file-output? and pass it to 'load-in-linux-vm'. (iso9660-image): Pass #:single-file-output? to 'expression->derivation-in-linux-vm'. * gnu/build/vm.scm (load-in-linux-vm): Add #:single-file-output? and honor it.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/vm.scm20
1 files changed, 16 insertions, 4 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 14bd7851f2..727494ad93 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -76,11 +76,14 @@
(qemu (qemu-command)) (memory-size 512)
linux initrd
make-disk-image?
+ single-file-output?
(disk-image-size (* 100 (expt 2 20)))
(disk-image-format "qcow2")
(references-graphs '()))
"Run BUILDER, a Scheme file, into a VM running LINUX with INITRD, and copy
-the result to OUTPUT.
+the result to OUTPUT. If SINGLE-FILE-OUTPUT? is true, copy a single file from
+/xchg to OUTPUT. Otherwise, copy the contents of /xchg to a new directory
+OUTPUT.
When MAKE-DISK-IMAGE? is true, OUTPUT will contain a VM image of
DISK-IMAGE-SIZE bytes resulting from the execution of BUILDER, which may
@@ -137,8 +140,17 @@ the #:references-graphs parameter of 'derivation'."
;; When MAKE-DISK-IMAGE? is true, the image is in OUTPUT already.
(unless make-disk-image?
- (mkdir output)
- (copy-recursively "xchg" output)))
+ (if single-file-output?
+ (let ((graph? (lambda (name stat)
+ (member (basename name) references-graphs))))
+ (match (find-files "xchg" (negate graph?))
+ ((result)
+ (copy-file result output))
+ (x
+ (error "did not find a single result file" x))))
+ (begin
+ (mkdir output)
+ (copy-recursively "xchg" output)))))
;;;
@@ -356,7 +368,7 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
(define* (make-iso9660-image grub config-file os-drv target
#:key (volume-id "GuixSD_image") (volume-uuid #f))
"Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
-Grub configuration and OS-DRV as the stuff in it."
+GRUB configuration and OS-DRV as the stuff in it."
(let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
(mkdir-p "/tmp/root/var/run")
(mkdir-p "/tmp/root/run")