[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/08: import: hackage: Filter internal libraries from inputs and native
From: |
guix-commits |
Subject: |
07/08: import: hackage: Filter internal libraries from inputs and native-inputs. |
Date: |
Mon, 6 Jun 2022 07:29:26 -0400 (EDT) |
lbraun pushed a commit to branch master
in repository guix.
commit dedfcaa8e2b948124f76121b9062c827fe649e29
Author: Lars-Dominik Braun <lars@6xq.net>
AuthorDate: Sun May 22 11:20:07 2022 +0200
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.
---
guix/import/hackage.scm | 17 ++++++++++-------
tests/hackage.scm | 19 +++++++++++++++++++
2 files changed, 29 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
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 85a5c2115c..a11dd14846 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -368,6 +368,25 @@ executable cabal
(test-assert "hackage->guix-package test without final newline"
(eval-test-with-cabal test-cabal-no-final-newline match-ghc-foo))
+;; Make sure internal libraries will not be part of the dependencies.
+(define test-cabal-internal-library-ignored
+ "name: foo
+version: 1.0.0
+homepage: http://test.org
+synopsis: synopsis
+description: description
+license: BSD3
+executable cabal
+ build-depends:
+ HTTP >= 4000.2.5 && < 4000.3,
+ internal
+library internal
+ build-depends: mtl >= 2.0 && < 3
+")
+
+(test-assert "hackage->guix-package test internal libraries are ignored"
+ (eval-test-with-cabal test-cabal-internal-library-ignored match-ghc-foo))
+
;; Check if-elif-else statements
(define test-cabal-if
"name: foo
- branch master updated (0c6123f8aa -> 143141726e), guix-commits, 2022/06/06
- 03/08: import: cabal: Allow properties without space between key and value., guix-commits, 2022/06/06
- 04/08: import: cabal: Allow curly bracket before else statement., guix-commits, 2022/06/06
- 06/08: import: cabal: Support library names, guix-commits, 2022/06/06
- 02/08: import: cabal: Allow curly brackets in more positions., guix-commits, 2022/06/06
- 01/08: import: cabal: Support elif statement., guix-commits, 2022/06/06
- 05/08: import: cabal: Document failing syntax through tests., guix-commits, 2022/06/06
- 07/08: import: hackage: Filter internal libraries from inputs and native-inputs.,
guix-commits <=
- 08/08: import: hackage: Filter upper/mixed case dependencies too., guix-commits, 2022/06/06