diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-10-07 23:23:09 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-10-08 12:01:49 +0200 |
| commit | fb59e275dd84152cf04f89cd5192145ccf071853 (patch) | |
| tree | 49b04f16b355fae967a8474922377cf66350edd5 /tests | |
| parent | 3c762a13bf0a8e15f2cf67d6a9eb27cf6d55267d (diff) | |
derivations: Add 'graft-derivation'.
* guix/derivations.scm (graft-derivation): New procedure.
* guix/build/graft.scm: New file.
* Makefile.am (MODULES): Add it.
* tests/derivations.scm ("graft-derivation"): New test.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/derivations.scm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm index 855b059d16b..48d12990e69 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm | |||
| @@ -813,6 +813,35 @@ Deriver: ~a~%" | |||
| 813 | (string<? p1 p2))))))))))))) | 813 | (string<? p1 p2))))))))))))) |
| 814 | 814 | ||
| 815 | 815 | ||
| 816 | (test-assert "graft-derivation" | ||
| 817 | (let* ((build `(begin | ||
| 818 | (mkdir %output) | ||
| 819 | (chdir %output) | ||
| 820 | (symlink %output "self") | ||
| 821 | (call-with-output-file "text" | ||
| 822 | (lambda (output) | ||
| 823 | (format output "foo/~a/bar" ,%mkdir))) | ||
| 824 | (symlink ,%bash "sh"))) | ||
| 825 | (orig (build-expression->derivation %store "graft" build | ||
| 826 | #:inputs `(("a" ,%bash) | ||
| 827 | ("b" ,%mkdir)))) | ||
| 828 | (one (add-text-to-store %store "bash" "fake bash")) | ||
| 829 | (two (build-expression->derivation %store "mkdir" | ||
| 830 | '(call-with-output-file %output | ||
| 831 | (lambda (port) | ||
| 832 | (display "fake mkdir" port))))) | ||
| 833 | (graft (graft-derivation %store "graft" orig | ||
| 834 | `(((,%bash) . (,one)) | ||
| 835 | ((,%mkdir) . (,two)))))) | ||
| 836 | (and (build-derivations %store (list graft)) | ||
| 837 | (let ((two (derivation->output-path two)) | ||
| 838 | (graft (derivation->output-path graft))) | ||
| 839 | (and (string=? (format #f "foo/~a/bar" two) | ||
| 840 | (call-with-input-file (string-append graft "/text") | ||
| 841 | get-string-all)) | ||
| 842 | (string=? (readlink (string-append graft "/sh")) one) | ||
| 843 | (string=? (readlink (string-append graft "/self")) graft)))))) | ||
| 844 | |||
| 816 | (test-equal "map-derivation" | 845 | (test-equal "map-derivation" |
| 817 | "hello" | 846 | "hello" |
| 818 | (let* ((joke (package-derivation %store guile-1.8)) | 847 | (let* ((joke (package-derivation %store guile-1.8)) |
