aboutsummaryrefslogtreecommitdiff
path: root/tests/hackage.scm
diff options
context:
space:
mode:
authorRobert Vollmert <rob@vllmrt.net>2019-06-13 21:39:14 +0200
committerTimothy Sample <samplet@ngyro.com>2019-06-13 22:18:52 -0400
commitca45da9fc9b1eee399ce4344b18cbb129daeca4c (patch)
tree361e65e3401f9c875ac5aa76ede6c6a5bcdab159 /tests/hackage.scm
parent30825c46298c70028f70da1470eadbadf1e0d858 (diff)
downloadpatches-ca45da9fc9b1eee399ce4344b18cbb129daeca4c.tar
patches-ca45da9fc9b1eee399ce4344b18cbb129daeca4c.tar.gz
import: hackage: Handle Hackage revisions.
Hackage packages can have metadata revisions (Cabal file only) that are not reflected in the source archive. The Haskell build system has support for this, but until now the Hackage importer would create a package based on the revised Cabal file which would then build using the old Cabal file. Fixes <https://bugs.gnu.org/35750>. * guix/import/cabal.scm (<cabal-package>): Add 'revision' field. (eval-cabal): Parse 'x-revision:' property. * guix/import/hackage.scm (read-cabal-and-hash): New procedure. (hackage-fetch-and-hash): New procedure. (hackage-fetch): Rewrite using 'hackage-fetch-and-hash'. (hackage-module->sexp): Add 'cabal-hash' argument and use it to populate the '#:cabal-revision' argument. (hackage->guix-package): Use the new '-and-hash' functions to get the hash of the Cabal file and pass it to 'hackage-module->sexp'. * guix/tests/hackage.scm: Test import of Cabal file revision. Signed-off-by: Timothy Sample <samplet@ngyro.com>
Diffstat (limited to 'tests/hackage.scm')
-rw-r--r--tests/hackage.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 38a5825af7..14176b2cf9 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -274,6 +274,51 @@ executable cabal
(test-assert "hackage->guix-package test multiline desc (braced)"
(eval-test-with-cabal test-cabal-multiline-braced match-ghc-foo))
+;; Check Hackage Cabal revisions.
+(define test-cabal-revision
+ "name: foo
+version: 1.0.0
+x-revision: 2
+homepage: http://test.org
+synopsis: synopsis
+description: description
+license: BSD3
+executable cabal
+ build-depends:
+ HTTP >= 4000.2.5 && < 4000.3,
+ mtl >= 2.0 && < 3
+")
+
+(define-package-matcher match-ghc-foo-revision
+ ('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-http" ('unquote 'ghc-http)))))
+ ('arguments
+ ('quasiquote
+ ('#:cabal-revision
+ ("2" "0xxd88fb659f0krljidbvvmkh9ppjnx83j0nqzx8whcg4n5qbyng"))))
+ ('home-page "http://test.org")
+ ('synopsis (? string?))
+ ('description (? string?))
+ ('license 'bsd-3)))
+
+(test-assert "hackage->guix-package test cabal revision"
+ (eval-test-with-cabal test-cabal-revision match-ghc-foo-revision))
+
(test-assert "read-cabal test 1"
(match (call-with-input-string test-read-cabal-1 read-cabal)
((("name" ("test-me"))