From 6b4663363c061071c10209f71aed1017a241af6c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 15 Oct 2020 23:01:57 +0200 Subject: packages: Delete duplicate inputs when lowering bags. This is a followup to 18fa433bf5c420868562b9f4b017c5c97251a44b and . * 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. --- tests/packages.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') 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))) -- cgit v1.2.3