aboutsummaryrefslogtreecommitdiff
path: root/tests/test.drv
blob: b7b1100d50cc7a2a1a98b308e46f2806949fa61d (about) (plain)
1
Derive([("out","/nix/store/yd0v41r8kj49xcjric62gk47lss9vdyg-hurd-qemu-test-build","","")],[("/nix/store/2fgw8gkxs1k8hfcsvir3q9wnkifdzs2s-bash-4.2-p20.drv",["out"]),("/nix/store/31n2fn5h1gydqs3a9zm5g40d2f886i7g-gnused-4.2.1-i586-pc-gnu.drv",["out"]),("/nix/store/34y69yzzb9a1v1fmixiqfhip9s57pybf-gnugrep-2.10-i586-pc-gnu.drv",["out"]),("/nix/store/6n80yhr7cwip45w8rccyk4bp7g7zlkwq-gnu-global-user-environment.drv",["out"]),("/nix/store/88ymj8xwrkmadyabbc1z96x4prabkhsx-gnumake-3.82-i586-pc-gnu.drv",["out"]),("/nix/store/8c61y42zw57axxixl0wikq6vszjbf9bw-qemu-kvm-0.15.1.drv",["out"]),("/nix/store/8dd520i02y7pkh5ynm7d5jb2lk0m7wzn-mig-20100512-i586-pc-gnu.drv",["out"]),("/nix/store/b4lcngrsl838jg37yn510g888nlf0f1v-gawk-4.0.0-i586-pc-gnu.drv",["out"]),("/nix/store/c4bq6crxpl4y9wd18fkvn81vj93m9wph-findutils-4.4.2-i586-pc-gnu.drv",["out"]),("/nix/store/dgbh8qzl4rr89jsrlsy382z84lmfwsj1-bzip2-1.0.6-i586-pc-gnu.drv",["out"]),("/nix/store/dsplzdbcqwgi9ybb7pfk5z9w6vxbn48h-diffutils-3.2-i586-pc-gnu.drv",["out"]),("/nix/store/f6d7aw8ji6yx715hr91a5bvlbr8hp818-hurd-tarball-0.drv",["out"]),("/nix/store/i81h625d3f6m8v587hx5mq6z6agkg221-gnused-4.2.1.drv",["out"]),("/nix/store/j3kf9392mxcs81vqnn06p5npb8lz4wn8-vm-run.drv",["out"]),("/nix/store/jqv7c1znv48c4w0vk4lmsczjxy0n0hjd-unionfs-20120313-i586-pc-gnu.drv",["out"]),("/nix/store/k34s0wnr7g7bshs61whzrp1vsg8gxzvq-gnutar-1.26-i586-pc-gnu.drv",["out"]),("/nix/store/m56fidnal30ns3zv7bqsxncnmpbqqymq-gnumach-20120303-i586-pc-gnu.drv",["out"]),("/nix/store/phn4yvgccfqyw6izcjbj1kh7lbxkkz4a-bash-4.2-p20-i586-pc-gnu.drv",["out"]),("/nix/store/q86x3m69wq2inrrgsa28d09aapah3nsq-hurd-0.drv",["out"]),("/nix/store/s79ij8nbf48ib60xdwpgf70jhksga31n-stdenv.drv",["out"]),("/nix/store/shsa80axsaxfkdlzpbw5d9ijgjqlmn05-gcc-wrapper-4.6.3-i586-pc-gnu.drv",["out"]),("/nix/store/x55vzgh17b41g1p1c6wf97pjy5mnww1d-gzip-1.4-i586-pc-gnu.drv",["out"]),("/nix/store/y7s99gdw53gf7d7bzhq9snbpdwjqa1ih-smbfs-2012-03-15-i586-pc-gnu.drv",["out"]),("/nix/store/yjq2plg890za7s16mm08x1jyfzj0q5hz-hurd-qemu-image.drv",["out"]),("/nix/store/yjzyf7ngsk816c2al76yprplnxysiwpz-xz-5.0.3-i586-pc-gnu.drv",["out"])],[],"x86_64-linux","/nix/store/xl3xf36l7mzwnl0fr6wxajhzhnm95ygm-bash-4.2-p20/bin/sh",["-e","/nix/store/yrzi7zsymp1a4hrjz75k4fk32kag4pzl-vm-run"],[("QEMU_OPTS","-m 512"),("buildCommand","echo 'Hey, this operating system works like a charm!'\n              echo \"Let's see if it can rebuild itself...\"\n\n              ( tar xvf \"/nix/store/kck9pjd6y2l1q15384sxywaknfm6b78f-hurd-tarball-0/tarballs/\"*.tar.gz ;\n                cd hurd-* ;\n                export PATH=\"/nix/store/svz656lvxh0li2pndfgdmgr4i48kbrv8-gawk-4.0.0-i586-pc-gnu/bin:$PATH\" ;\n                set -e ;\n                ./configure --without-parted --prefix=\"/host/xchg/out\" ;\n                make                             # sequential build\n              )\n\n              # FIXME: \"make install\" not run because `rm' fails on SMBFS.\n              mkdir /host/xchg/out\n\n              echo $? > /host/xchg/in-vm-exit\n"),("buildInputs",""),("buildNativeInputs",""),("builder","/nix/store/xl3xf36l7mzwnl0fr6wxajhzhnm95ygm-bash-4.2-p20/bin/sh"),("diskImage","/nix/store/2gqgnw6nmh8ksr5l05cqirw3mdcrnf5p-hurd-qemu-image"),("diskImageBuildInputs","/nix/store/laqpxpssky7v039ga4mvk1c3b36r4gf4-gnumach-20120303-i586-pc-gnu /nix/store/9ypm9rs110msqgb8qykzsxgiab2a6rd7-hurd-0 /nix/store/mkcd3692mkd0llswx3cr9ca6vl12nqzk-gnused-4.2.1-i586-pc-gnu /nix/store/z3zw00xy4ik8b8d6qnaqwbkybr0p2m69-gnugrep-2.10-i586-pc-gnu /nix/store/280rn2c6b6gfg9ynl3qs3zxbgrlkg06d-findutils-4.4.2-i586-pc-gnu /nix/store/wmq0mp74p5ksigq7mpl709l1w8685zqs-diffutils-3.2-i586-pc-gnu /nix/store/b4c3gmg90xyyk13kqwz8hqikjyq1vxyd-bash-4.2-p20-i586-pc-gnu /nix/store/hsxib1jm1ksxnlhxsm00zqhfwln3vp5c-gcc-wrapper-4.6.3-i586-pc-gnu /nix/store/zdjgbwh43yl9kq3j6h5ri3bylinkinzl-gnumake-3.82-i586-pc-gnu /nix/store/xb9llifg0hy342rnj96j70lkbvdmf13h-gnutar-1.26-i586-pc-gnu /nix/store/y8cdvni1hqwmzfwm2ija9v2xb6iqflnx-gzip-1.4-i586-pc-gnu /nix/store/7p7gjd7d605sg1z6m2kvg0zqwylqz4z1-bzip2-1.0.6-i586-pc-gnu /nix/store/0b93rb8x7wh439glp6278xzsq0gf0xcd-xz-5.0.3-i586-pc-gnu /nix/store/6ikghbgf3s71ar1rswk3zczsj03ca3pn-mig-20100512-i586-pc-gnu /nix/store/3jqfrl6f69h65bmx7yzc1prk64993929-smbfs-2012-03-15-i586-pc-gnu /nix/store/nqscl1nn75353qcr9qq5v7w58c24gj12-unionfs-20120313-i586-pc-gnu /nix/store/kp99qz7whrpfc7jy3ycssr3gvrbdz8ra-gnu-global-user-environment /nix/store/laqpxpssky7v039ga4mvk1c3b36r4gf4-gnumach-20120303-i586-pc-gnu /nix/store/9ypm9rs110msqgb8qykzsxgiab2a6rd7-hurd-0 /nix/store/3jqfrl6f69h65bmx7yzc1prk64993929-smbfs-2012-03-15-i586-pc-gnu/hurd/smbfs -s 10.0.2.4 -r smb://10.0.2.4/xchg -u root -p '' /nix/store/3jqfrl6f69h65bmx7yzc1prk64993929-smbfs-2012-03-15-i586-pc-gnu/hurd/smbfs -s 10.0.2.4 -r smb://10.0.2.4/store -u root -p ''"),("memSize","512"),("name","hurd-qemu-test-build"),("out","/nix/store/yd0v41r8kj49xcjric62gk47lss9vdyg-hurd-qemu-test-build"),("postVM","cp -prvd xchg/out \"$out\"\n"),("preVM","diskImage=$(pwd)/disk-image.qcow2\norigImage=\"/nix/store/2gqgnw6nmh8ksr5l05cqirw3mdcrnf5p-hurd-qemu-image\"\nif test -d \"$origImage\"; then origImage=\"$origImage/disk-image.qcow2\"; fi\n/nix/store/sxczq7kv8265b41yr03s4c41pklyq0ih-qemu-kvm-0.15.1/bin/qemu-img create -b \"$origImage\" -f qcow2 $diskImage\n\n# XXX: Until the guest's /nix/store is a unionfs of its actual\n# store and the host's one (i.e., when both unionfs and smbfs\n# implement `io_map', so that ld.so can load binaries off them),\n# rewrite store paths.\necho \"$buildCommand\" | \\\n  /nix/store/w5hacn80b04v1f09nkyypc0sd7bhrknb-gnused-4.2.1/bin/sed -r \\\n    -e's|/nix/store/([0-9a-z]{32})-([^ ]+)|/host/store/\\1-\\2|g' \\\n  > xchg/cmd\n\neval \"$postPreVM\"\n"),("propagatedBuildInputs",""),("propagatedBuildNativeInputs",""),("requiredSystemFeatures","kvm"),("stdenv","/nix/store/7c8asx3yfrg5dg1gzhzyq2236zfgibnm-stdenv"),("system","x86_64-linux")])
)) #:use-module (ice-9 ftw) #:export (write-cpio-archive build-initrd)) ;;; Commentary: ;;; ;;; Tools to create Linux initial RAM disks ("initrds"). Initrds are ;;; essentially gzipped cpio archives, with a '/init' executable that the ;;; kernel runs at boot time. ;;; ;;; Code: (define* (write-cpio-archive output directory #:key (compress? #t) (gzip "gzip")) "Write a cpio archive containing DIRECTORY to file OUTPUT, with reset timestamps in the archive. When COMPRESS? is true, compress it using GZIP. On success, return OUTPUT." ;; Note: as per `ramfs-rootfs-initramfs.txt', always add directory entries ;; before the files that are inside of it: "The Linux kernel cpio ;; extractor won't create files in a directory that doesn't exist, so the ;; directory entries must go before the files that go in those ;; directories." (define files ;; Use 'sort' so that (1) the order of files is deterministic, and (2) ;; directories appear before the files they contain. (sort (file-system-fold (const #t) ;enter? (lambda (file stat result) ;leaf (cons file result)) (lambda (dir stat result) ;down (if (string=? dir directory) result (cons dir result))) (lambda (file stat result) result) (const #f) ;skip (const #f) ;error '() directory) string<?)) (call-with-output-file output (lambda (port) (cpio:write-cpio-archive files port #:file->header cpio:file->cpio-header*))) (if compress? ;; 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) "Return the file name of the in-cache .go file for FILE, relative to the current directory. This is similar to what 'compiled-file-name' in (system base compile) does." (let loop ((file file)) (let ((target (false-if-exception (readlink file)))) (if target (loop target) (format #f ".cache/guile/ccache/~a-~a-~a-~a/~a" (effective-version) (if (eq? (native-endianness) (endianness little)) "LE" "BE") (sizeof '*) (effective-version) file))))) (define (compile-to-cache file) "Compile FILE to the cache." (let ((compiled-file (cache-compiled-file-name file))) (mkdir-p (dirname compiled-file)) (compile-file file #:opts %auto-compilation-options #:output-file compiled-file))) (define* (build-initrd output #:key guile init (references-graphs '()) (gzip "gzip")) "Write an initial RAM disk (initrd) to OUTPUT. The initrd starts the script at INIT, running GUILE. It contains all the items referred to by REFERENCES-GRAPHS." (mkdir "contents") ;; Copy the closures of all the items referenced in REFERENCES-GRAPHS. (populate-store references-graphs "contents" #:deduplicate? #f) (with-directory-excursion "contents" ;; Make '/init'. (symlink init "init") ;; Compile it. (compile-to-cache "init") ;; Allow Guile to find out where it is (XXX). See ;; 'guile-relocatable.patch'. (mkdir-p "proc/self") (symlink (string-append guile "/bin/guile") "proc/self/exe") (readlink "proc/self/exe") (write-cpio-archive output "." #:gzip gzip)) ;; Make sure directories are writable so we can delete files. (for-each make-file-writable (find-files "contents" (lambda (file stat) (eq? 'directory (stat:type stat))) #:directories? #t)) (delete-file-recursively "contents")) ;;; linux-initrd.scm ends here