aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-09 18:51:25 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-09 18:52:16 +0200
commit26b969dee0d1abb92b44998dc573dad79b76d4cd (patch)
treeb711051e69b2c5ddf344ae02f7277dc1ac49ced3
parent749c6567554c1da258992173f66fb41d8511f4e3 (diff)
downloadguix-26b969dee0d1abb92b44998dc573dad79b76d4cd.tar
guix-26b969dee0d1abb92b44998dc573dad79b76d4cd.tar.gz
Add support for fixed-output derivations in `build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Pass HASH and HASH-ALGO to `derivation'. * tests/derivations.scm ("build-expression->derivation for fixed-output derivation"): New test.
-rw-r--r--guix/derivations.scm3
-rw-r--r--tests/derivations.scm23
2 files changed, 25 insertions, 1 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index b7733e9a1a..5897630205 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -396,4 +396,5 @@ from INPUTS."
(derivation store name system guile `("--no-auto-compile" ,builder)
'(("HOME" . "/homeless"))
`((,(%guile-for-build))
- (,builder)))))
+ (,builder))
+ #:hash hash #:hash-algo hash-algo)))
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 06001078c5..34098d79ca 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -141,6 +141,29 @@
(let ((p (derivation-path->output-path drv-path)))
(string-contains (call-with-input-file p read-line) "GNU")))))
+(test-skip (if (false-if-exception (getaddrinfo "ftp.gnu.org" "http"))
+ 0
+ 1))
+
+(test-assert "build-expression->derivation for fixed-output derivation"
+ (let* ((url "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz")
+ (builder `(begin
+ (use-modules (web client) (web uri)
+ (rnrs io ports))
+ (let ((bv (http-get (string->uri ,url)
+ #:decode-body? #f)))
+ (call-with-output-file %output
+ (lambda (p)
+ (put-bytevector p bv))))))
+ (drv-path (build-expression->derivation
+ %store "hello-2.8.tar.gz" "x86_64-linux" builder '()
+ #:hash (nix-base32-string->bytevector
+ "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6")
+ #:hash-algo 'sha256))
+ (succeeded? (build-derivations %store (list drv-path))))
+ (and succeeded?
+ (file-exists? (derivation-path->output-path drv-path)))))
+
(test-end)