summary refs log tree commit diff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-10-15 23:01:57 +0200
committerLudovic Courtès <ludo@gnu.org>2020-10-15 23:05:32 +0200
commit6b4663363c061071c10209f71aed1017a241af6c (patch)
treeabfc3bf16dda33ed4aa398e94f2ca3205049737d /tests/packages.scm
parent370adc91b59ac06243067a31122f567a7c35b24b (diff)
downloadguix-6b4663363c061071c10209f71aed1017a241af6c.tar.gz
packages: Delete duplicate inputs when lowering bags.
This is a followup to 18fa433bf5c420868562b9f4b017c5c97251a44b and
<https://issues.guix.gnu.org/43508>.

* guix/packages.scm (derivation=?, input=?): New procedures.
(bag->derivation, bag->cross-derivation): Add calls to
'delete-duplicates'.
* tests/packages.scm ("package-derivation, inputs deduplicated"): New
test.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index cbd0503733..2649c2497f 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -611,6 +611,19 @@
     (and (derivation? drv)
          (file-exists? (derivation-file-name drv)))))
 
+(test-assert "package-derivation, inputs deduplicated"
+  (let* ((dep (dummy-package "dep"))
+         (p0  (dummy-package "p" (inputs `(("dep" ,dep)))))
+         (p1  (package (inherit p0)
+                       (inputs `(("dep" ,(package (inherit dep)))
+                                 ,@(package-inputs p0))))))
+    ;; Here P1 ends up with two non-eq? copies of DEP, under the same label.
+    ;; They should be deduplicated so that P0 and P1 lead to the same
+    ;; derivation rather than P1 ending up with duplicate entries in its
+    ;; '%build-inputs' variable.
+    (string=? (derivation-file-name (package-derivation %store p0))
+              (derivation-file-name (package-derivation %store p1)))))
+
 (test-assert "package-output"
   (let* ((package  (dummy-package "p"))
          (drv      (package-derivation %store package)))