gexp: Allow <gexp-input> objects in #:allowed-references.
authorLudovic Courtès <ludo@gnu.org>
Sat, 21 Mar 2015 22:21:53 +0000 (23:21 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sun, 22 Mar 2015 22:18:30 +0000 (23:18 +0100)
* guix/gexp.scm (lower-references): Add <gexp-input> case.
* tests/gexp.scm ("gexp->derivation #:allowed-references, specific
  output"): New test.

guix/gexp.scm
tests/gexp.scm

index 4a2a924..218914c 100644 (file)
@@ -201,6 +201,11 @@ names and file names suitable for the #:allowed-references argument to
       (match-lambda
        ((? string? output)
         (return output))
+       (($ <gexp-input> thing output native?)
+        (mlet* %store-monad ((lower -> (lookup-compiler thing))
+                             (drv      (lower thing system
+                                              (if native? #f target))))
+          (return (derivation->output-path drv output))))
        (thing
         (mlet* %store-monad ((lower -> (lookup-compiler thing))
                              (drv      (lower thing system target)))
index 4c31e22..27c0846 100644 (file)
                                              (list "out" %bootstrap-guile))))
     (built-derivations (list drv))))
 
+(test-assertm "gexp->derivation #:allowed-references, specific output"
+  (mlet* %store-monad ((in  (gexp->derivation "thing"
+                                              #~(begin
+                                                  (mkdir #$output:ok)
+                                                  (mkdir #$output:not-ok))))
+                       (drv (gexp->derivation "allowed-refs"
+                                              #~(begin
+                                                  (pk #$in:not-ok)
+                                                  (mkdir #$output)
+                                                  (chdir #$output)
+                                                  (symlink #$output "self")
+                                                  (symlink #$in:ok "ok"))
+                                              #:allowed-references
+                                              (list "out"
+                                                    (gexp-input in "ok")))))
+    (built-derivations (list drv))))
+
 (test-assert "gexp->derivation #:allowed-references, disallowed"
   (let ((drv (run-with-store %store
                (gexp->derivation "allowed-refs"