aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-08-26 22:12:46 +0200
committerLudovic Courtès <ludo@gnu.org>2013-08-26 22:20:53 +0200
commit5b0c9d1635df1608a498db8718af575d2f0e1663 (patch)
treec4e38d7d3b566507b8d966971b780705506fabb8 /guix
parenta987d2c02525efd1bf37b4bb5b5df405a06bd15c (diff)
downloadgnu-guix-5b0c9d1635df1608a498db8718af575d2f0e1663.tar
gnu-guix-5b0c9d1635df1608a498db8718af575d2f0e1663.tar.gz
derivations: Add #:dependency-graphs `derivation' parameter.
* guix/derivations.scm (derivation): Add `dependency-graphs' keyword parameter; honor it. * tests/derivations.scm (bootstrap-binary): New procedure. (%bash): Use it. (%mkdir): New variable. (directory-contents): Add `slurp' optional parameter. ("derivation with #:dependency-graphs"): New test. * doc/guix.texi (Derivations): Update accordingly.
Diffstat (limited to 'guix')
-rw-r--r--guix/derivations.scm28
1 files changed, 24 insertions, 4 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 3d7a30aaa8..fea9984370 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -501,11 +501,16 @@ the derivation called NAME with hash HASH."
#:key
(system (%current-system)) (env-vars '())
(inputs '()) (outputs '("out"))
- hash hash-algo hash-mode)
+ hash hash-algo hash-mode
+ dependency-graphs)
"Build a derivation with the given arguments. Return the resulting
store path and <derivation> object. When HASH, HASH-ALGO, and HASH-MODE
are given, a fixed-output derivation is created---i.e., one whose result is
-known in advance, such as a file download."
+known in advance, such as a file download.
+
+When DEPENDENCY-GRAPHS is true, it must be a list of file name/store path
+pairs. In that case, the reference graph of each store path is exported in
+the build environment in the corresponding file, in a simple text format."
(define direct-store-path?
(let ((len (+ 1 (string-length (%store-prefix)))))
(lambda (p)
@@ -540,7 +545,22 @@ known in advance, such as a file download."
value))))
env-vars))))))
- (define (env-vars-with-empty-outputs)
+ (define (user+system-env-vars)
+ ;; Some options are passed to the build daemon via the env. vars of
+ ;; derivations (urgh!). We hide that from our API, but here is the place
+ ;; where we kludgify those options.
+ (match dependency-graphs
+ (((file . path) ...)
+ (let ((value (map (cut string-append <> " " <>)
+ file path)))
+ ;; XXX: This all breaks down if an element of FILE or PATH contains
+ ;; white space.
+ `(("exportReferencesGraph" . ,(string-join value " "))
+ ,@env-vars)))
+ (#f
+ env-vars)))
+
+ (define (env-vars-with-empty-outputs env-vars)
;; Return a variant of ENV-VARS where each OUTPUTS is associated with an
;; empty string, even outputs that do not appear in ENV-VARS.
(let ((e (map (match-lambda
@@ -572,7 +592,7 @@ known in advance, such as a file download."
#t "sha256" input)))
(make-derivation-input path '()))))
(delete-duplicates inputs)))
- (env-vars (env-vars-with-empty-outputs))
+ (env-vars (env-vars-with-empty-outputs (user+system-env-vars)))
(drv-masked (make-derivation outputs
(filter (compose derivation-path?
derivation-input-path)