summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/gexp.scm4
-rw-r--r--tests/gexp.scm16
2 files changed, 18 insertions, 2 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 8cd44ba534..b72b8f4061 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -875,9 +875,9 @@ corresponding <derivation-input> or store item."
   (define tuple->gexp-input
     (match-lambda
       ((thing)
-       (%gexp-input thing "out" #t))
+       (%gexp-input thing "out" (not target)))
       ((thing output)
-       (%gexp-input thing output #t))))
+       (%gexp-input thing output (not target)))))
 
   (match graphs
     (((file-names . inputs) ...)
diff --git a/tests/gexp.scm b/tests/gexp.scm
index a30d0ff6b4..834e78b9a0 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1095,6 +1095,22 @@ importing.* \\(guix config\\) from the host"
                         (call-with-input-file g-guile read)
                         (list (derivation->output-path guile-drv) bash))))))
 
+(test-assertm "gexp->derivation #:references-graphs cross-compilation"
+  ;; The objects passed in #:references-graphs implicitly refer to
+  ;; cross-compiled derivations.  Make sure this is the case.
+  (mlet* %store-monad ((drv1 (lower-object coreutils (%current-system)
+                                           #:target "i586-pc-gnu"))
+                       (drv2 (lower-object coreutils (%current-system)
+                                           #:target #f))
+                       (drv3 (gexp->derivation "three"
+                                               #~(symlink #$coreutils #$output)
+                                               #:target "i586-pc-gnu"
+                                               #:references-graphs
+                                               `(("coreutils" ,coreutils))))
+                       (refs (references* (derivation-file-name drv3))))
+    (return (and (member (derivation-file-name drv1) refs)
+                 (not (member (derivation-file-name drv2) refs))))))
+
 (test-assertm "gexp->derivation #:allowed-references"
   (mlet %store-monad ((drv (gexp->derivation "allowed-refs"
                                              #~(begin