profiles: Delete duplicate manifest entries in packages->manifest.

* gnu/profiles.scm (packages->manifest): Delete duplicate entries.
* tests/profiles.scm ("packages->manifest, no duplicates"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Leo Prikler 2020-12-05 17:20:10 +01:00 committed by Ludovic Courtès
parent f5d952c5f5
commit 07340cbebc
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 28 additions and 16 deletions

View file

@ -399,6 +399,7 @@ (define (inferior->entry)
'inferior-package->manifest-entry))
(manifest
(delete-duplicates
(map (match-lambda
(((? package? package) output)
(package->manifest-entry package output))
@ -414,7 +415,8 @@ (define (inferior->entry)
((inferior->entry) thing)
(throw 'wrong-type-arg 'packages->manifest
"Wrong package object: ~S" (list thing) (list thing)))))
packages)))
packages)
manifest-entry=?)))
(define (manifest->gexp manifest)
"Return a representation of MANIFEST as a gexp."

View file

@ -384,6 +384,16 @@ (define (find-input package)
(manifest-entry-search-paths
(package->manifest-entry mpl)))))
(test-assert "packages->manifest, no duplicates"
(let ((expected
(manifest
(list
(package->manifest-entry packages:guile-2.2))))
(manifest (packages->manifest
(list packages:guile-2.2 packages:guile-2.2))))
(every manifest-entry=? (manifest-entries expected)
(manifest-entries manifest))))
(test-equal "packages->manifest, propagated inputs"
(map (match-lambda
((label package)