summaryrefslogtreecommitdiff
path: root/tests
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
parent30825c46298c70028f70da1470eadbadf1e0d858 (diff)
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')
-rw-r--r--tests/hackage.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 38a5825af72..14176b2cf9e 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -274,6 +274,51 @@ executable cabal
274(test-assert "hackage->guix-package test multiline desc (braced)" 274(test-assert "hackage->guix-package test multiline desc (braced)"
275 (eval-test-with-cabal test-cabal-multiline-braced match-ghc-foo)) 275 (eval-test-with-cabal test-cabal-multiline-braced match-ghc-foo))
276 276
277;; Check Hackage Cabal revisions.
278(define test-cabal-revision
279 "name: foo
280version: 1.0.0
281x-revision: 2
282homepage: http://test.org
283synopsis: synopsis
284description: description
285license: BSD3
286executable cabal
287 build-depends:
288 HTTP >= 4000.2.5 && < 4000.3,
289 mtl >= 2.0 && < 3
290")
291
292(define-package-matcher match-ghc-foo-revision
293 ('package
294 ('name "ghc-foo")
295 ('version "1.0.0")
296 ('source
297 ('origin
298 ('method 'url-fetch)
299 ('uri ('string-append
300 "https://hackage.haskell.org/package/foo/foo-"
301 'version
302 ".tar.gz"))
303 ('sha256
304 ('base32
305 (? string? hash)))))
306 ('build-system 'haskell-build-system)
307 ('inputs
308 ('quasiquote
309 (("ghc-http" ('unquote 'ghc-http)))))
310 ('arguments
311 ('quasiquote
312 ('#:cabal-revision
313 ("2" "0xxd88fb659f0krljidbvvmkh9ppjnx83j0nqzx8whcg4n5qbyng"))))
314 ('home-page "http://test.org")
315 ('synopsis (? string?))
316 ('description (? string?))
317 ('license 'bsd-3)))
318
319(test-assert "hackage->guix-package test cabal revision"
320 (eval-test-with-cabal test-cabal-revision match-ghc-foo-revision))
321
277(test-assert "read-cabal test 1" 322(test-assert "read-cabal test 1"
278 (match (call-with-input-string test-read-cabal-1 read-cabal) 323 (match (call-with-input-string test-read-cabal-1 read-cabal)
279 ((("name" ("test-me")) 324 ((("name" ("test-me"))