import: hackage: Fix Cabal test.
* guix/import/hackage.scm (hackage->guix-package): Remove call to 'memoize'. (hackage->guix-package/m): New procedure. (hackage-recursive-import): Use it. * tests/hackage.scm ("hackage->guix-package test 6"): Adjust. Co-authored-by: Robert Vollmert <rob@vllmrt.net>
This commit is contained in:
parent
002d17dcaa
commit
ad7466aafd
|
@ -279,9 +279,7 @@ representation of a Cabal file as produced by 'read-cabal'."
|
||||||
(license ,(string->license (cabal-package-license cabal))))
|
(license ,(string->license (cabal-package-license cabal))))
|
||||||
(append hackage-dependencies hackage-native-dependencies))))
|
(append hackage-dependencies hackage-native-dependencies))))
|
||||||
|
|
||||||
(define hackage->guix-package
|
(define* (hackage->guix-package package-name #:key
|
||||||
(memoize
|
|
||||||
(lambda* (package-name #:key
|
|
||||||
(include-test-dependencies? #t)
|
(include-test-dependencies? #t)
|
||||||
(port #f)
|
(port #f)
|
||||||
(cabal-environment '()))
|
(cabal-environment '()))
|
||||||
|
@ -301,12 +299,16 @@ respectively."
|
||||||
(and=> cabal-meta (compose (cut hackage-module->sexp <>
|
(and=> cabal-meta (compose (cut hackage-module->sexp <>
|
||||||
#:include-test-dependencies?
|
#:include-test-dependencies?
|
||||||
include-test-dependencies?)
|
include-test-dependencies?)
|
||||||
(cut eval-cabal <> cabal-environment)))))))
|
(cut eval-cabal <> cabal-environment)))))
|
||||||
|
|
||||||
|
(define hackage->guix-package/m ;memoized variant
|
||||||
|
(memoize hackage->guix-package))
|
||||||
|
|
||||||
(define* (hackage-recursive-import package-name . args)
|
(define* (hackage-recursive-import package-name . args)
|
||||||
(recursive-import package-name #f
|
(recursive-import package-name #f
|
||||||
#:repo->guix-package (lambda (name repo)
|
#:repo->guix-package (lambda (name repo)
|
||||||
(apply hackage->guix-package (cons name args)))
|
(apply hackage->guix-package/m
|
||||||
|
(cons name args)))
|
||||||
#:guix-name hackage-name->package-name))
|
#:guix-name hackage-name->package-name))
|
||||||
|
|
||||||
(define (hackage-package? package)
|
(define (hackage-package? package)
|
||||||
|
|
|
@ -207,8 +207,41 @@ library
|
||||||
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
||||||
|
|
||||||
(test-assert "hackage->guix-package test 6"
|
(test-assert "hackage->guix-package test 6"
|
||||||
(eval-test-with-cabal test-cabal-6
|
(mock
|
||||||
#:cabal-environment '(("impl" . "ghc-7.8"))))
|
((guix import hackage) hackage-fetch
|
||||||
|
(lambda (name-version)
|
||||||
|
(call-with-input-string test-cabal-6
|
||||||
|
read-cabal)))
|
||||||
|
(match (hackage->guix-package "foo")
|
||||||
|
(('package
|
||||||
|
('name "ghc-foo")
|
||||||
|
('version "1.0.0")
|
||||||
|
('source
|
||||||
|
('origin
|
||||||
|
('method 'url-fetch)
|
||||||
|
('uri ('string-append
|
||||||
|
"https://hackage.haskell.org/package/foo/foo-"
|
||||||
|
'version
|
||||||
|
".tar.gz"))
|
||||||
|
('sha256
|
||||||
|
('base32
|
||||||
|
(? string? hash)))))
|
||||||
|
('build-system 'haskell-build-system)
|
||||||
|
('inputs
|
||||||
|
('quasiquote
|
||||||
|
(("ghc-b" ('unquote 'ghc-b))
|
||||||
|
("ghc-http" ('unquote 'ghc-http))
|
||||||
|
("ghc-mtl" ('unquote 'ghc-mtl)))))
|
||||||
|
('native-inputs
|
||||||
|
('quasiquote
|
||||||
|
(("ghc-haskell-gi" ('unquote 'ghc-haskell-gi)))))
|
||||||
|
('home-page "http://test.org")
|
||||||
|
('synopsis (? string?))
|
||||||
|
('description (? string?))
|
||||||
|
('license 'bsd-3))
|
||||||
|
#t)
|
||||||
|
(x
|
||||||
|
(pk 'fail x #f)))))
|
||||||
|
|
||||||
(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)
|
||||||
|
|
Loading…
Reference in New Issue