summary refs log tree commit diff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-06-11 18:24:59 +0200
committerLudovic Courtès <ludo@gnu.org>2020-06-11 19:05:05 +0200
commit03a70e4c190420e87c0b535285caf8f77260d4ff (patch)
treedbf3f3952af4990b959e048b1ae2766c1fc83ffa /tests/packages.scm
parentcbd9581acc41cd49eb81c2432452cad4de805cbd (diff)
downloadguix-03a70e4c190420e87c0b535285caf8f77260d4ff.tar.gz
packages: 'package-grafts' returns grafts for all the relevant outputs.
Fixes <https://bugs.gnu.org/41796>.
Reported by Jakub Kądziołka <kuba@kadziolka.net>.

* guix/packages.scm (input-graft): Add 'output' parameter and honor it.
Add OUTPUT to the cache key.
(input-cross-graft): Likewise.
(fold-bag-dependencies): Operate on inputs instead of nodes.  Turn
VISITED into a vhash instead of a set.  Pass PROC HEAD and OUTPUT
instead of just HEAD.
(bag-grafts): Adjust accordingly.
* tests/packages.scm ("package-grafts, dependency on several outputs"):
New test.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 72e87dbfb7..c7b6f669b5 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -900,6 +900,30 @@
                                                          (replacement #f))))
                     (replacement (package-derivation %store new)))))))
 
+(test-assert "package-grafts, dependency on several outputs"
+  ;; Make sure we get one graft per output; see <https://bugs.gnu.org/41796>.
+  (letrec* ((p0  (dummy-package "p0"
+                   (version "1.0")
+                   (replacement p0*)
+                   (arguments '(#:implicit-inputs? #f))
+                   (outputs '("out" "lib"))))
+            (p0* (package (inherit p0) (version "1.1")))
+            (p1  (dummy-package "p1"
+                   (arguments '(#:implicit-inputs? #f))
+                   (inputs `(("p0" ,p0)
+                             ("p0:lib" ,p0 "lib"))))))
+    (lset= equal? (pk (package-grafts %store p1))
+           (list (graft
+                   (origin (package-derivation %store p0))
+                   (origin-output "out")
+                   (replacement (package-derivation %store p0*))
+                   (replacement-output "out"))
+                 (graft
+                   (origin (package-derivation %store p0))
+                   (origin-output "lib")
+                   (replacement (package-derivation %store p0*))
+                   (replacement-output "lib"))))))
+
 (test-assert "replacement also grafted"
   ;; We build a DAG as below, where dotted arrows represent replacements and
   ;; solid arrows represent dependencies: