diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-09-06 15:45:32 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-09-06 23:42:56 +0200 |
commit | b53833b2ef36cf139f65193bec688396a734b0d0 (patch) | |
tree | 36869e74c9147a95fb7ad3e8dea9bc65216dc093 /tests | |
parent | 108293c5ea65502e351cb2f6682668d5d345dd1f (diff) | |
download | guix-b53833b2ef36cf139f65193bec688396a734b0d0.tar guix-b53833b2ef36cf139f65193bec688396a734b0d0.tar.gz |
gexp: Allow use of high-level objects in #:references-graphs.
* guix/gexp.scm (lower-reference-graphs): New procedure.
(gexp->derivation)[graphs-file-names]: New procedure.
Use 'lower-reference-graphs', and augment #:inputs argument as a
function of #:references-graphs.
* doc/guix.texi (G-Expressions): Adjust 'gexp->derivation' documentation
accordingly.
* tests/gexp.scm ("gexp->derivation, store copy"): Remove reference to
TWO in BUILD-DRV. Use TWO directly in #:references-graphs argument.
("gexp->derivation #:references-graphs"): New test.
* gnu/system/vm.scm (qemu-image): Remove variable 'graph'; use INPUTS as
the #:references-graphs argument to
'expression->derivation-in-linux-vm'.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gexp.scm | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index a08164c484..ea4df48403 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -335,19 +335,16 @@ (call-with-output-file (string-append #$output "/two") (lambda (port) (display "This is the second one." port)))))) - (build-drv (lambda (two) - #~(begin - (use-modules (guix build store-copy)) + (build-drv #~(begin + (use-modules (guix build store-copy)) - (mkdir #$output) - '#$two ;make it an input - (populate-store '("graph") #$output))))) + (mkdir #$output) + (populate-store '("graph") #$output)))) (mlet* %store-monad ((one (gexp->derivation "one" build-one)) (two (gexp->derivation "two" (build-two one))) - (dir -> (derivation->output-path two)) - (drv (gexp->derivation "store-copy" (build-drv two) + (drv (gexp->derivation "store-copy" build-drv #:references-graphs - `(("graph" . ,dir)) + `(("graph" ,two)) #:modules '((guix build store-copy) (guix build utils)))) @@ -362,6 +359,43 @@ (string=? (readlink (string-append out "/" two "/one")) one))))))) +(test-assertm "gexp->derivation #:references-graphs" + (mlet* %store-monad + ((one (text-file "one" "hello, world")) + (two (gexp->derivation "two" + #~(symlink #$one #$output:chbouib))) + (drv (gexp->derivation "ref-graphs" + #~(begin + (use-modules (guix build store-copy)) + (with-output-to-file #$output + (lambda () + (write (call-with-input-file "guile" + read-reference-graph)))) + (with-output-to-file #$output:one + (lambda () + (write (call-with-input-file "one" + read-reference-graph)))) + (with-output-to-file #$output:two + (lambda () + (write (call-with-input-file "two" + read-reference-graph))))) + #:references-graphs `(("one" ,one) + ("two" ,two "chbouib") + ("guile" ,%bootstrap-guile)) + #:modules '((guix build store-copy) + (guix build utils)))) + (ok? (built-derivations (list drv))) + (guile-drv (package->derivation %bootstrap-guile)) + (g-one -> (derivation->output-path drv "one")) + (g-two -> (derivation->output-path drv "two")) + (g-guile -> (derivation->output-path drv))) + (return (and ok? + (equal? (call-with-input-file g-one read) (list one)) + (equal? (call-with-input-file g-two read) + (list one (derivation->output-path two "chbouib"))) + (equal? (call-with-input-file g-guile read) + (list (derivation->output-path guile-drv))))))) + (define shebang (string-append "#!" (derivation->output-path (%guile-for-build)) "/bin/guile --no-auto-compile")) |