import: minetest: Delete duplicate dependencies.

This fixes one of the issues noted in <https://issues.guix.gnu.org/50425#4>.

* guix/import/minetest.scm
  (import-dependencies): Call 'delete-duplicates' on the resulting list.
* tests/minetest.scm
  ("minetest->guix-package, multiple dependencies implemented by one mod"):
  New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Maxime Devos 2021-09-07 13:05:56 +02:00 committed by Ludovic Courtès
parent 8d4c0e3104
commit 8480a2a5bb
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 15 additions and 1 deletions

View File

@ -371,7 +371,11 @@ official Minetest forum and the Git repository (if any)."
DEPENDENCIES as a list of AUTHOR/NAME strings."
(define dependency-list
(assoc-ref dependencies author/name))
(filter-map
;; A mod can have multiple dependencies implemented by the same mod,
;; so remove duplicate mod names.
(define (filter-deduplicate-map f list)
(delete-duplicates (filter-map f list)))
(filter-deduplicate-map
(lambda (dependency)
(and (not (dependency-optional? dependency))
(not (builtin-mod? (dependency-name dependency)))

View File

@ -331,6 +331,16 @@ during a dynamic extent where that package is available on ContentDB."
"some-modpack/containing-mese")))
#:inputs '())
;; See e.g. 'orwell/basic_trains'
(test-package* "minetest->guix-package, multiple dependencies implemented by one mod"
(list #:name "frobnicate"
#:guix-name "minetest-frobnicate"
#:upstream-name "Author/frobnicate"
#:requirements '(("frob" #f ("Author/frob"))
("frob_x" #f ("Author/frob")))
#:inputs '("minetest-frob"))
(list #:author "Author" #:name "frob"))
;; License
(test-package "minetest->guix-package, identical licenses"