aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-04 16:07:36 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-04 16:07:53 +0100
commitdd1a5a152c679ba2d386dc66127a0de924182e26 (patch)
treedb197f2ae1f1655c87a93f3313b9185aa8d36d32 /tests
parent7b63fa8d155310e4e66cdb2914e01557fb36f272 (diff)
downloadpatches-dd1a5a152c679ba2d386dc66127a0de924182e26.tar
patches-dd1a5a152c679ba2d386dc66127a0de924182e26.tar.gz
derivations: Use more keyword parameters for 'build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Turn 'system' and 'inputs' into keyword parameters. Adjust callers accordingly. * gnu/system/linux.scm, gnu/system/vm.scm, guix/build-system/cmake.scm, guix/build-system/gnu.scm, guix/build-system/perl.scm, guix/build-system/python.scm, guix/build-system/trivial.scm, guix/download.scm, guix/packages.scm, guix/profiles.scm, guix/scripts/pull.scm, tests/derivations.scm, tests/guix-build.sh, tests/monads.scm, tests/store.scm, tests/union.scm: Adjust users of 'build-expression->derivation' and 'derivation-expression' accordingly. * doc/guix.texi (Derivations): Adjust 'build-expression->derivation' documentation accordingly. (The Store Monad): Likewise for 'derivation-expression'.
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm76
-rw-r--r--tests/guix-build.sh3
-rw-r--r--tests/monads.scm5
-rw-r--r--tests/store.scm6
-rw-r--r--tests/union.scm4
5 files changed, 32 insertions, 62 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index a4e073bf07..f7cedde505 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -395,8 +395,7 @@
(test-skip (if (%guile-for-build) 0 8))
(test-assert "build-expression->derivation and derivation-prerequisites"
- (let ((drv (build-expression->derivation %store "fail" (%current-system)
- #f '())))
+ (let ((drv (build-expression->derivation %store "fail" #f)))
(any (match-lambda
(($ <derivation-input> path)
(string=? path (derivation-file-name (%guile-for-build)))))
@@ -408,8 +407,7 @@
(call-with-output-file (string-append %output "/test")
(lambda (p)
(display '(hello guix) p)))))
- (drv (build-expression->derivation %store "goo" (%current-system)
- builder '()))
+ (drv (build-expression->derivation %store "goo" builder))
(succeeded? (build-derivations %store (list drv))))
(and succeeded?
(let ((p (derivation->output-path drv)))
@@ -421,9 +419,7 @@
(set-build-options s #:max-silent-time 1)
s))
(builder '(begin (sleep 100) (mkdir %output) #t))
- (drv (build-expression->derivation store "silent"
- (%current-system)
- builder '()))
+ (drv (build-expression->derivation store "silent" builder))
(out-path (derivation->output-path drv)))
(guard (c ((nix-protocol-error? c)
(and (string-contains (nix-protocol-error-message c)
@@ -433,22 +429,19 @@
#f)))
(test-assert "build-expression->derivation and derivation-prerequisites-to-build"
- (let ((drv (build-expression->derivation %store "fail" (%current-system)
- #f '())))
+ (let ((drv (build-expression->derivation %store "fail" #f)))
;; The only direct dependency is (%guile-for-build) and it's already
;; built.
(null? (derivation-prerequisites-to-build %store drv))))
(test-assert "derivation-prerequisites-to-build when outputs already present"
(let* ((builder '(begin (mkdir %output) #t))
- (input-drv (build-expression->derivation %store "input"
- (%current-system)
- builder '()))
+ (input-drv (build-expression->derivation %store "input" builder))
(input-path (derivation-output-path
(assoc-ref (derivation-outputs input-drv)
"out")))
- (drv (build-expression->derivation %store "something"
- (%current-system) builder
+ (drv (build-expression->derivation %store "something" builder
+ #:inputs
`(("i" ,input-drv))))
(output (derivation->output-path drv)))
;; Make sure these things are not already built.
@@ -474,8 +467,7 @@
(test-assert "derivation-prerequisites-to-build and substitutes"
(let* ((store (open-connection))
(drv (build-expression->derivation store "prereq-subst"
- (%current-system)
- (random 1000) '()))
+ (random 1000)))
(output (derivation->output-path drv))
(dir (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
(compose uri-path string->uri))))
@@ -515,8 +507,7 @@ Deriver: ~a~%"
(let* ((builder '(begin
(mkdir %output)
#f)) ; fail!
- (drv (build-expression->derivation %store "fail" (%current-system)
- builder '()))
+ (drv (build-expression->derivation %store "fail" builder))
(out-path (derivation->output-path drv)))
(guard (c ((nix-protocol-error? c)
;; Note that the output path may exist at this point, but it
@@ -535,9 +526,7 @@ Deriver: ~a~%"
(call-with-output-file (assoc-ref %outputs "second")
(lambda (p)
(display '(world) p)))))
- (drv (build-expression->derivation %store "double"
- (%current-system)
- builder '()
+ (drv (build-expression->derivation %store "double" builder
#:outputs '("out"
"second")))
(succeeded? (build-derivations %store (list drv))))
@@ -556,8 +545,8 @@ Deriver: ~a~%"
(dup2 (port->fdes p) 1)
(execl (string-append cu "/bin/uname")
"uname" "-a")))))
- (drv (build-expression->derivation %store "uname" (%current-system)
- builder
+ (drv (build-expression->derivation %store "uname" builder
+ #:inputs
`(("cu" ,%coreutils))))
(succeeded? (build-derivations %store (list drv))))
(and succeeded?
@@ -588,8 +577,7 @@ Deriver: ~a~%"
(mkdir-p (string-append out "/guile/guix/nix"))
#t)))
(drv (build-expression->derivation %store "test-with-modules"
- (%current-system)
- builder '()
+ builder
#:modules
'((guix build utils)))))
(and (build-derivations %store (list drv))
@@ -605,14 +593,10 @@ Deriver: ~a~%"
(lambda (p)
(write "hello" p))))
(hash (sha256 (string->utf8 "hello")))
- (input1 (build-expression->derivation %store "fixed"
- (%current-system)
- builder1 '()
+ (input1 (build-expression->derivation %store "fixed" builder1
#:hash hash
#:hash-algo 'sha256))
- (input2 (build-expression->derivation %store "fixed"
- (%current-system)
- builder2 '()
+ (input2 (build-expression->derivation %store "fixed" builder2
#:hash hash
#:hash-algo 'sha256))
(succeeded? (build-derivations %store (list input1 input2))))
@@ -630,27 +614,21 @@ Deriver: ~a~%"
(lambda (p)
(write "hello" p))))
(hash (sha256 (string->utf8 "hello")))
- (input1 (build-expression->derivation %store "fixed"
- (%current-system)
- builder1 '()
+ (input1 (build-expression->derivation %store "fixed" builder1
#:hash hash
#:hash-algo 'sha256))
- (input2 (build-expression->derivation %store "fixed"
- (%current-system)
- builder2 '()
+ (input2 (build-expression->derivation %store "fixed" builder2
#:hash hash
#:hash-algo 'sha256))
(builder3 '(let ((input (assoc-ref %build-inputs "input")))
(call-with-output-file %output
(lambda (out)
(format #f "My input is ~a.~%" input)))))
- (final1 (build-expression->derivation %store "final"
- (%current-system)
- builder3
+ (final1 (build-expression->derivation %store "final" builder3
+ #:inputs
`(("input" ,input1))))
- (final2 (build-expression->derivation %store "final"
- (%current-system)
- builder3
+ (final2 (build-expression->derivation %store "final" builder3
+ #:inputs
`(("input" ,input2)))))
(and (string=? (derivation->output-path final1)
(derivation->output-path final2))
@@ -664,8 +642,7 @@ Deriver: ~a~%"
(list %bash %mkdir)))
(builder '(copy-file "input" %output))
(drv (build-expression->derivation %store "references-graphs"
- (%current-system)
- builder '()
+ builder
#:references-graphs
`(("input" . ,input))))
(out (derivation->output-path drv)))
@@ -697,22 +674,17 @@ Deriver: ~a~%"
(let* ((joke (package-derivation %store guile-1.8))
(good (package-derivation %store %bootstrap-guile))
(drv1 (build-expression->derivation %store "original-drv1"
- (%current-system)
#f ; systematically fail
- '()
#:guile-for-build joke))
(drv2 (build-expression->derivation %store "original-drv2"
- (%current-system)
'(call-with-output-file %output
(lambda (p)
- (display "hello" p)))
- '()))
+ (display "hello" p)))))
(drv3 (build-expression->derivation %store "drv-to-remap"
- (%current-system)
'(let ((in (assoc-ref
%build-inputs "in")))
(copy-file in %output))
- `(("in" ,drv1))
+ #:inputs `(("in" ,drv1))
#:guile-for-build joke))
(drv4 (map-derivation %store drv3 `((,drv1 . ,drv2)
(,joke . ,good))))
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 391e7b9da3..d66e132c1f 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -77,6 +77,5 @@ then false; else true; fi
guix build -e "(begin
(use-modules (guix monads) (guix utils))
(lambda ()
- (derivation-expression \"test\" (%current-system)
- '(mkdir %output) '())))" \
+ (derivation-expression \"test\" '(mkdir %output))))" \
--dry-run
diff --git a/tests/monads.scm b/tests/monads.scm
index 4608deec9e..7fc2aa90c1 100644
--- a/tests/monads.scm
+++ b/tests/monads.scm
@@ -116,8 +116,9 @@
(mkdir out)
(symlink ,guile
(string-append out "/guile-rocks"))))
- (drv (derivation-expression "rocks" (%current-system)
- exp `(("g" ,gdrv))))
+ (drv (derivation-expression "rocks" exp
+ #:inputs
+ `(("g" ,gdrv))))
(out -> (derivation->output-path drv))
(built? (built-derivations (list drv))))
(return (and built?
diff --git a/tests/store.scm b/tests/store.scm
index 741803884d..f1a3f160f4 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -236,12 +236,11 @@ Deriver: ~a~%"
(let* ((s (open-connection))
(c (random-text)) ; contents of the output
(d (build-expression->derivation
- s "substitute-me" (%current-system)
+ s "substitute-me"
`(call-with-output-file %output
(lambda (p)
(exit 1) ; would actually fail
(display ,c p)))
- '()
#:guile-for-build
(package-derivation s %bootstrap-guile (%current-system))))
(o (derivation->output-path d))
@@ -288,11 +287,10 @@ Deriver: ~a~%"
(let* ((s (open-connection))
(t (random-text)) ; contents of the output
(d (build-expression->derivation
- s "substitute-me-not" (%current-system)
+ s "substitute-me-not"
`(call-with-output-file %output
(lambda (p)
(display ,t p)))
- '()
#:guile-for-build
(package-derivation s %bootstrap-guile (%current-system))))
(o (derivation->output-path d))
diff --git a/tests/union.scm b/tests/union.scm
index 54e2850942..3ebf483efa 100644
--- a/tests/union.scm
+++ b/tests/union.scm
@@ -104,8 +104,8 @@
(map cdr %build-inputs))))
(drv
(build-expression->derivation %store "union-test"
- (%current-system)
- builder inputs
+ builder
+ #:inputs inputs
#:modules '((guix build union)))))
(and (build-derivations %store (list (pk 'drv drv)))
(with-directory-excursion (derivation->output-path drv)