mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-29 21:41:15 +02:00
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>
This commit is contained in:
committed by
Timothy Sample
parent
30825c4629
commit
ca45da9fc9
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user