summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2020-12-08 13:41:47 +0100
committerJulien Lepiller <julien@lepiller.eu>2020-12-08 16:40:19 +0100
commit59873d94ceb97b5ca95d3dc7ea91332c66c753d2 (patch)
treee81b5b6dc7bc5900f5bfd5c61c5baaa3ed909ae0
parent4e110f61ac43ead1230f7cf18b8d8cc70c8bfe88 (diff)
downloadguix-59873d94ceb97b5ca95d3dc7ea91332c66c753d2.tar.gz
guix: opam: Filter implicit inputs.
* guix/import/opam.scm (opam->guix-package, depends->inputs): Filter out
implicit inputs.
-rw-r--r--guix/import/opam.scm21
1 files changed, 11 insertions, 10 deletions
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 78d72df2ce..4f366a9384 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -235,12 +235,15 @@ path to the repository."
                      (equal? "ocaml" name))
                names)))
 
-(define (depends->inputs depends)
+(define (filter-dependencies depends)
+  "Remove implicit dependencies from the list of dependencies in @var{depends}."
   (filter (lambda (name)
-            (and (not (equal? "" name))
-                 (not (equal? "ocaml" name))
-                 (not (equal? "ocamlfind" name))))
-    (map dependency->input depends)))
+            (and (not (member name '("" "ocaml" "ocamlfind" "dune" "jbuilder")))
+                 (not (string-prefix? "base-" name))))
+          depends))
+
+(define (depends->inputs depends)
+  (filter-dependencies (map dependency->input depends)))
 
 (define (depends->native-inputs depends)
   (filter (lambda (name) (not (equal? "" name)))
@@ -272,7 +275,8 @@ or #f on failure."
              (source-url (or (metadata-ref url-dict "src")
                              (metadata-ref url-dict "archive")))
              (requirements (metadata-ref opam-content "depends"))
-             (dependencies (dependency-list->names requirements))
+             (names (dependency-list->names requirements))
+             (dependencies (filter-dependencies names))
              (native-dependencies (depends->native-inputs requirements))
              (inputs (dependency-list->inputs (depends->inputs requirements)))
              (native-inputs (dependency-list->inputs
@@ -282,10 +286,7 @@ or #f on failure."
                                 (lambda (name)
                                   (not (member name '("dune" "jbuilder"))))
                                 native-dependencies))))
-        ;; If one of these are required at build time, it means we
-        ;; can use the much nicer dune-build-system.
-        (let ((use-dune? (or (member "dune" (append dependencies native-dependencies))
-                        (member "jbuilder" (append dependencies native-dependencies)))))
+        (let ((use-dune? (member "dune" names)))
           (call-with-temporary-output-file
             (lambda (temp port)
               (and (url-fetch source-url temp)