build-system: haskell: Add ‘hackage-uri’ procedure.
* guix/build-system/haskell (hackage-uri): New procedure. * guix/import/hackage.scm (hackage-module->sexp, latest-release): Use it. * tests/hackage.scm (match-ghc-foo, match-ghc-foo-6, match-ghc-foo-revision, match-ghc-foo-import): Adjust accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>master
parent
a955e4d7f6
commit
39f4ef59ff
|
@ -2,6 +2,7 @@
|
||||||
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
|
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
|
||||||
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
|
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
|
||||||
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
|
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
|
||||||
|
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -30,7 +31,9 @@
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:export (%haskell-build-system-modules
|
#:export (hackage-uri
|
||||||
|
|
||||||
|
%haskell-build-system-modules
|
||||||
haskell-build
|
haskell-build
|
||||||
haskell-build-system))
|
haskell-build-system))
|
||||||
|
|
||||||
|
@ -41,6 +44,12 @@
|
||||||
;;
|
;;
|
||||||
;; Code:
|
;; Code:
|
||||||
|
|
||||||
|
(define (hackage-uri name version)
|
||||||
|
"Return a URI string for the Haskell package hosted on Hackage corresponding
|
||||||
|
to NAME and VERSION."
|
||||||
|
(string-append "https://hackage.haskell.org/package/" name "/"
|
||||||
|
name "-" version ".tar.gz"))
|
||||||
|
|
||||||
(define %haskell-build-system-modules
|
(define %haskell-build-system-modules
|
||||||
;; Build-side modules imported by default.
|
;; Build-side modules imported by default.
|
||||||
`((guix build haskell-build-system)
|
`((guix build haskell-build-system)
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#:use-module (guix memoization)
|
#:use-module (guix memoization)
|
||||||
#:use-module (guix upstream)
|
#:use-module (guix upstream)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
|
#:autoload (guix build-system haskell) (hackage-uri)
|
||||||
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
|
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
|
||||||
#:export (%hackage-url
|
#:export (%hackage-url
|
||||||
hackage->guix-package
|
hackage->guix-package
|
||||||
|
@ -303,7 +304,7 @@ the hash of the Cabal file."
|
||||||
(version ,version)
|
(version ,version)
|
||||||
(source (origin
|
(source (origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
(uri (string-append ,@(factorize-uri source-url version)))
|
(uri (hackage-uri ,name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
,(if tarball
|
,(if tarball
|
||||||
|
@ -367,7 +368,7 @@ respectively."
|
||||||
(hackage-cabal-url hackage-name))
|
(hackage-cabal-url hackage-name))
|
||||||
#f)
|
#f)
|
||||||
((_ *** ("version" (version)))
|
((_ *** ("version" (version)))
|
||||||
(let ((url (hackage-source-url hackage-name version)))
|
(let ((url (hackage-uri hackage-name version)))
|
||||||
(upstream-source
|
(upstream-source
|
||||||
(package (package-name package))
|
(package (package-name package))
|
||||||
(version version)
|
(version version)
|
||||||
|
|
|
@ -170,10 +170,7 @@ library
|
||||||
('source
|
('source
|
||||||
('origin
|
('origin
|
||||||
('method 'url-fetch)
|
('method 'url-fetch)
|
||||||
('uri ('string-append
|
('uri ('hackage-uri "foo" 'version))
|
||||||
"https://hackage.haskell.org/package/foo/foo-"
|
|
||||||
'version
|
|
||||||
".tar.gz"))
|
|
||||||
('sha256
|
('sha256
|
||||||
('base32
|
('base32
|
||||||
(? string? hash)))))
|
(? string? hash)))))
|
||||||
|
@ -215,10 +212,7 @@ library
|
||||||
('source
|
('source
|
||||||
('origin
|
('origin
|
||||||
('method 'url-fetch)
|
('method 'url-fetch)
|
||||||
('uri ('string-append
|
('uri ('hackage-uri "foo" 'version))
|
||||||
"https://hackage.haskell.org/package/foo/foo-"
|
|
||||||
'version
|
|
||||||
".tar.gz"))
|
|
||||||
('sha256
|
('sha256
|
||||||
('base32
|
('base32
|
||||||
(? string? hash)))))
|
(? string? hash)))))
|
||||||
|
@ -343,10 +337,7 @@ executable cabal
|
||||||
('source
|
('source
|
||||||
('origin
|
('origin
|
||||||
('method 'url-fetch)
|
('method 'url-fetch)
|
||||||
('uri ('string-append
|
('uri ('hackage-uri "foo" 'version))
|
||||||
"https://hackage.haskell.org/package/foo/foo-"
|
|
||||||
'version
|
|
||||||
".tar.gz"))
|
|
||||||
('sha256
|
('sha256
|
||||||
('base32
|
('base32
|
||||||
(? string? hash)))))
|
(? string? hash)))))
|
||||||
|
@ -409,10 +400,7 @@ executable cabal
|
||||||
('source
|
('source
|
||||||
('origin
|
('origin
|
||||||
('method 'url-fetch)
|
('method 'url-fetch)
|
||||||
('uri ('string-append
|
('uri ('hackage-uri "foo" 'version))
|
||||||
"https://hackage.haskell.org/package/foo/foo-"
|
|
||||||
'version
|
|
||||||
".tar.gz"))
|
|
||||||
('sha256
|
('sha256
|
||||||
('base32
|
('base32
|
||||||
(? string? hash)))))
|
(? string? hash)))))
|
||||||
|
|
Reference in New Issue