guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/05: guix: opam: Filter implicit inputs.


From: guix-commits
Subject: 02/05: guix: opam: Filter implicit inputs.
Date: Tue, 8 Dec 2020 10:57:05 -0500 (EST)

roptat pushed a commit to branch master
in repository guix.

commit 59873d94ceb97b5ca95d3dc7ea91332c66c753d2
Author: Julien Lepiller <julien@lepiller.eu>
AuthorDate: Tue Dec 8 13:41:47 2020 +0100

    guix: opam: Filter implicit inputs.
    
    * guix/import/opam.scm (opam->guix-package, depends->inputs): Filter out
    implicit inputs.
---
 guix/import/opam.scm | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 78d72df..4f366a9 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]