import: hackage: Evaluate "-any" and "-none" version comparison operators.
* guix/import/cabal.scm (eval-cabal): Modify. * tests/hackage.scm (test-cabal-4): New variable and test. (test-cabal-5): New variable and test. (test-cabal-6): New variable and test.
This commit is contained in:
parent
fd115bee31
commit
e39a44f340
|
@ -754,6 +754,8 @@ the ordering operation and the version."
|
||||||
((string= spec-op ">") (version>? comp-ver spec-ver))
|
((string= spec-op ">") (version>? comp-ver spec-ver))
|
||||||
((string= spec-op "<=") (not (version>? comp-ver spec-ver)))
|
((string= spec-op "<=") (not (version>? comp-ver spec-ver)))
|
||||||
((string= spec-op "<") (not (version>=? comp-ver spec-ver)))
|
((string= spec-op "<") (not (version>=? comp-ver spec-ver)))
|
||||||
|
((string= spec-op "-any") #t)
|
||||||
|
((string= spec-op "-none") #f)
|
||||||
(else
|
(else
|
||||||
(raise (condition
|
(raise (condition
|
||||||
(&message (message "Failed to evaluate 'impl' test."))))))
|
(&message (message "Failed to evaluate 'impl' test."))))))
|
||||||
|
|
|
@ -69,6 +69,65 @@ library
|
||||||
mtl >= 2.0 && < 3
|
mtl >= 2.0 && < 3
|
||||||
")
|
")
|
||||||
|
|
||||||
|
;; Check "-any", "-none" when name is different.
|
||||||
|
(define test-cabal-4
|
||||||
|
"name: foo
|
||||||
|
version: 1.0.0
|
||||||
|
homepage: http://test.org
|
||||||
|
synopsis: synopsis
|
||||||
|
description: description
|
||||||
|
license: BSD3
|
||||||
|
library
|
||||||
|
if impl(ghcjs -any)
|
||||||
|
Build-depends: ghc-a
|
||||||
|
if impl(ghc>=7.2&&<7.6)
|
||||||
|
Build-depends: ghc-b
|
||||||
|
if impl(ghc == 7.8)
|
||||||
|
Build-depends:
|
||||||
|
HTTP >= 4000.2.5 && < 4000.3,
|
||||||
|
mtl >= 2.0 && < 3
|
||||||
|
")
|
||||||
|
|
||||||
|
;; Check "-any", "-none".
|
||||||
|
(define test-cabal-5
|
||||||
|
"name: foo
|
||||||
|
version: 1.0.0
|
||||||
|
homepage: http://test.org
|
||||||
|
synopsis: synopsis
|
||||||
|
description: description
|
||||||
|
license: BSD3
|
||||||
|
library
|
||||||
|
if impl(ghc == 7.8)
|
||||||
|
Build-depends:
|
||||||
|
HTTP >= 4000.2.5 && < 4000.3,
|
||||||
|
if impl(ghc -any)
|
||||||
|
Build-depends: mtl >= 2.0 && < 3
|
||||||
|
if impl(ghc>=7.2&&<7.6)
|
||||||
|
Build-depends: ghc-b
|
||||||
|
")
|
||||||
|
|
||||||
|
;; Check "custom-setup".
|
||||||
|
(define test-cabal-6
|
||||||
|
"name: foo
|
||||||
|
build-type: Custom
|
||||||
|
version: 1.0.0
|
||||||
|
homepage: http://test.org
|
||||||
|
synopsis: synopsis
|
||||||
|
description: description
|
||||||
|
license: BSD3
|
||||||
|
custom-setup
|
||||||
|
setup-depends: base >= 4.7 && < 5,
|
||||||
|
Cabal >= 1.24,
|
||||||
|
haskell-gi == 0.21.*
|
||||||
|
library
|
||||||
|
if impl(ghc>=7.2&&<7.6)
|
||||||
|
Build-depends: ghc-b
|
||||||
|
if impl(ghc == 7.8)
|
||||||
|
Build-depends:
|
||||||
|
HTTP >= 4000.2.5 && < 4000.3,
|
||||||
|
mtl >= 2.0 && < 3
|
||||||
|
")
|
||||||
|
|
||||||
;; A fragment of a real Cabal file with minor modification to check precedence
|
;; A fragment of a real Cabal file with minor modification to check precedence
|
||||||
;; of 'and' over 'or', missing final newline, spaces between keywords and
|
;; of 'and' over 'or', missing final newline, spaces between keywords and
|
||||||
;; parentheses and between key and column.
|
;; parentheses and between key and column.
|
||||||
|
@ -139,6 +198,18 @@ library
|
||||||
(eval-test-with-cabal test-cabal-3
|
(eval-test-with-cabal test-cabal-3
|
||||||
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
||||||
|
|
||||||
|
(test-assert "hackage->guix-package test 4"
|
||||||
|
(eval-test-with-cabal test-cabal-4
|
||||||
|
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
||||||
|
|
||||||
|
(test-assert "hackage->guix-package test 5"
|
||||||
|
(eval-test-with-cabal test-cabal-5
|
||||||
|
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
||||||
|
|
||||||
|
(test-assert "hackage->guix-package test 6"
|
||||||
|
(eval-test-with-cabal test-cabal-6
|
||||||
|
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
||||||
|
|
||||||
(test-assert "read-cabal test 1"
|
(test-assert "read-cabal test 1"
|
||||||
(match (call-with-input-string test-read-cabal-1 read-cabal)
|
(match (call-with-input-string test-read-cabal-1 read-cabal)
|
||||||
((("name" ("test-me"))
|
((("name" ("test-me"))
|
||||||
|
|
Loading…
Reference in New Issue