mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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.
This commit is contained in:
parent
c3fbaee345
commit
dedfcaa8e2
2 changed files with 29 additions and 7 deletions
|
@ -222,12 +222,13 @@ (define (cabal-custom-setup-dependencies->names cabal)
|
|||
'())))
|
||||
(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 @@ (define revision
|
|||
(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 @@ (define hackage-native-dependencies
|
|||
(cabal-test-dependencies->names cabal)
|
||||
'())
|
||||
(cabal-custom-setup-dependencies->names cabal))
|
||||
(cabal-package-name cabal))
|
||||
own-names)
|
||||
hackage-dependencies))
|
||||
|
||||
(define dependencies
|
||||
|
|
|
@ -368,6 +368,25 @@ (define test-cabal-no-final-newline
|
|||
(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
|
||||
|
|
Loading…
Reference in a new issue