summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-26 23:18:21 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-26 23:20:30 +0200
commitad7466aafd7f166d0b6be5eb32dda1d3ee8a6445 (patch)
tree5984728bf94a6b3cb11140b9bb986c573cf59d05 /guix
parent002d17dcaacba0f86265b34f2509419d9e21224d (diff)
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>
Diffstat (limited to 'guix')
-rw-r--r--guix/import/hackage.scm32
1 files changed, 17 insertions, 15 deletions
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 2731b4cbee..bf7e99df18 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -279,13 +279,11 @@ representation of a Cabal file as produced by 'read-cabal'."
(license ,(string->license (cabal-package-license cabal))))
(append hackage-dependencies hackage-native-dependencies))))
-(define hackage->guix-package
- (memoize
- (lambda* (package-name #:key
- (include-test-dependencies? #t)
- (port #f)
- (cabal-environment '()))
- "Fetch the Cabal file for PACKAGE-NAME from hackage.haskell.org, or, if the
+(define* (hackage->guix-package package-name #:key
+ (include-test-dependencies? #t)
+ (port #f)
+ (cabal-environment '()))
+ "Fetch the Cabal file for PACKAGE-NAME from hackage.haskell.org, or, if the
called with keyword parameter PORT, from PORT. Return the `package'
S-expression corresponding to that package, or #f on failure.
CABAL-ENVIRONMENT is an alist defining the environment in which the Cabal
@@ -295,18 +293,22 @@ symbol 'true' or 'false'. The value associated with other keys has to conform
to the Cabal file format definition. The default value associated with the
keys \"os\", \"arch\" and \"impl\" is \"linux\", \"x86_64\" and \"ghc\"
respectively."
- (let ((cabal-meta (if port
- (read-cabal (canonical-newline-port port))
- (hackage-fetch package-name))))
- (and=> cabal-meta (compose (cut hackage-module->sexp <>
- #:include-test-dependencies?
- include-test-dependencies?)
- (cut eval-cabal <> cabal-environment)))))))
+ (let ((cabal-meta (if port
+ (read-cabal (canonical-newline-port port))
+ (hackage-fetch package-name))))
+ (and=> cabal-meta (compose (cut hackage-module->sexp <>
+ #:include-test-dependencies?
+ include-test-dependencies?)
+ (cut eval-cabal <> cabal-environment)))))
+
+(define hackage->guix-package/m ;memoized variant
+ (memoize hackage->guix-package))
(define* (hackage-recursive-import package-name . args)
(recursive-import package-name #f
#: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))
(define (hackage-package? package)