From b53be755e465be04dc05e9069178874cb9f1f44d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 1 Jun 2014 23:32:26 +0200 Subject: derivations: Add #:allowed-references 'derivation' parameter. * guix/derivations.scm (derivation): Add #:allowed-references parameter. [user+system-env-vars]: Honor it. * tests/derivations.scm ("derivation #:allowed-references, ok", "derivation #:allowed-references, not allowed", "derivation #:allowed-references, self allowed", "derivation #:allowed-references, self not allowed"): New tests. * doc/guix.texi (Derivations): Document #:allowed-references. --- guix/derivations.scm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'guix/derivations.scm') diff --git a/guix/derivations.scm b/guix/derivations.scm index 09b7ec079e..8d0c9c08df 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -565,7 +565,7 @@ HASH-ALGO, of the derivation NAME. RECURSIVE? has the same meaning as for (system (%current-system)) (env-vars '()) (inputs '()) (outputs '("out")) hash hash-algo recursive? - references-graphs + references-graphs allowed-references local-build?) "Build a derivation with the given arguments, and return the resulting object. When HASH and HASH-ALGO are given, a @@ -578,6 +578,9 @@ When REFERENCES-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. +When ALLOWED-REFERENCES is true, it must be a list of store items or outputs +that the derivation's output may refer to. + When LOCAL-BUILD? is true, declare that the derivation is not a good candidate for offloading and should rather be built locally. This is the case for small derivations where the costs of data transfers would outweigh the benefits." @@ -615,10 +618,14 @@ derivations where the costs of data transfers would outweigh the benefits." ;; 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. - (let ((env-vars (if local-build? - `(("preferLocalBuild" . "1") - ,@env-vars) - env-vars))) + (let ((env-vars `(,@(if local-build? + `(("preferLocalBuild" . "1")) + '()) + ,@(if allowed-references + `(("allowedReferences" + . ,(string-join allowed-references))) + '()) + ,@env-vars))) (match references-graphs (((file . path) ...) (let ((value (map (cut string-append <> " " <>) -- cgit v1.2.3