diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-06-09 23:16:55 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-06-09 23:16:55 +0200 |
commit | 9bc07f4df0b69b4eae86e8ca574713e3048d9a31 (patch) | |
tree | 8e1704a07333639a1f8d98e9a26cc4f0c1ec3626 /guix/derivations.scm | |
parent | 7946c4e710b921c9354ef74557872926d48ea42a (diff) | |
download | gnu-guix-9bc07f4df0b69b4eae86e8ca574713e3048d9a31.tar gnu-guix-9bc07f4df0b69b4eae86e8ca574713e3048d9a31.tar.gz |
Add multiple-output support to `build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Add `outputs'
keyword parameter; pass it to `derivation'. Define `%outputs' in the
prologue.
* tests/derivations.scm ("build-expression->derivation with two
outputs"): New test.
Diffstat (limited to 'guix/derivations.scm')
-rw-r--r-- | guix/derivations.scm | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index 38e05b25f2..b5e3db2d21 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -373,18 +373,24 @@ known in advance, such as a file download." (make-parameter (false-if-exception (nixpkgs-derivation "guile")))) (define* (build-expression->derivation store name system exp inputs - #:key hash hash-algo) + #:key (outputs '("out")) + hash hash-algo) "Return a derivation that executes Scheme expression EXP as a builder for derivation NAME. INPUTS must be a list of string/derivation-path pairs. EXP -is evaluated in an environment where %OUTPUT is bound to the output path, and -where %BUILD-INPUTS is bound to an alist of string/output-path pairs made -from INPUTS." +is evaluated in an environment where %OUTPUT is bound to the main output +path, %OUTPUTS is bound to a list of output/path pairs, and where +%BUILD-INPUTS is bound to an alist of string/output-path pairs made from +INPUTS." (define guile (string-append (derivation-path->output-path (%guile-for-build)) "/bin/guile")) (let* ((prologue `(begin (define %output (getenv "out")) + (define %outputs + (map (lambda (o) + (cons o (getenv o))) + ',outputs)) (define %build-inputs ',(map (match-lambda ((name . drv) @@ -400,4 +406,5 @@ from INPUTS." '(("HOME" . "/homeless")) `((,(%guile-for-build)) (,builder)) - #:hash hash #:hash-algo hash-algo))) + #:hash hash #:hash-algo hash-algo + #:outputs outputs))) |