summaryrefslogtreecommitdiff
path: root/guix/import
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-05-22 11:20:07 +0200
committerLars-Dominik Braun <lars@6xq.net>2022-06-06 13:26:45 +0200
commitdedfcaa8e2b948124f76121b9062c827fe649e29 (patch)
tree04a074487ab362bcc98a47370eb27db00c5938b8 /guix/import
parentc3fbaee34548fbfb1617dc7fccc94c598efbd7a6 (diff)
import: hackage: Filter internal libraries from inputs and native-inputs.
Fixes <https://issues.guix.gnu.org/54760>. * guix/import/hackage.scm (filter-dependencies): Support multiple OWN-NAMES. (hackage-module->sexp): Filter OWN-NAMES from HACKAGE-DEPENDENCIES and HACKAGE-NATIVE-DEPENDENCIES. * tests/hackage.scm (test-cabal-internal-library-ignored): New variable. ("hackage->guix-package test internal libraries are ignored"): New testcase.
Diffstat (limited to 'guix/import')
-rw-r--r--guix/import/hackage.scm17
1 files changed, 10 insertions, 7 deletions
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 0d6c77e399..6e982366cf 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -222,12 +222,13 @@ object."
'())))
(map cabal-dependency-name custom-setup-dependencies)))
-(define (filter-dependencies dependencies own-name)
+(define (filter-dependencies dependencies own-names)
"Filter the dependencies included with the GHC compiler from DEPENDENCIES, a
-list with the names of dependencies. OWN-NAME is the name of the Cabal
-package being processed and is used to filter references to itself."
+list with the names of dependencies. OWN-NAMES is the name of the Cabal
+package being processed and its internal libaries and is used to filter
+references to itself."
(filter (lambda (d) (not (member (string-downcase d)
- (cons own-name ghc-standard-libraries))))
+ (append own-names ghc-standard-libraries))))
dependencies))
(define* (hackage-module->sexp cabal cabal-hash
@@ -248,9 +249,11 @@ the hash of the Cabal file."
(define source-url
(hackage-source-url name version))
+ (define own-names (cons (cabal-package-name cabal)
+ (map cabal-library-name (cabal-package-library cabal))))
+
(define hackage-dependencies
- (filter-dependencies (cabal-dependencies->names cabal)
- (cabal-package-name cabal)))
+ (filter-dependencies (cabal-dependencies->names cabal) own-names))
(define hackage-native-dependencies
(lset-difference
@@ -260,7 +263,7 @@ the hash of the Cabal file."
(cabal-test-dependencies->names cabal)
'())
(cabal-custom-setup-dependencies->names cabal))
- (cabal-package-name cabal))
+ own-names)
hackage-dependencies))
(define dependencies