[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/11: build-system: haskell: Add ‘hackage-uri’ procedure.
From: |
guix-commits |
Subject: |
07/11: build-system: haskell: Add ‘hackage-uri’ procedure. |
Date: |
Wed, 1 Dec 2021 11:55:27 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 39f4ef59ffc37259de40f67c476a1a720aa8d007
Author: Xinglu Chen <public@yoctocell.xyz>
AuthorDate: Tue Nov 2 17:48:09 2021 +0100
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>
---
guix/build-system/haskell.scm | 11 ++++++++++-
guix/import/hackage.scm | 5 +++--
tests/hackage.scm | 20 ++++----------------
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm
index 18a584f..72e37f2 100644
--- a/guix/build-system/haskell.scm
+++ b/guix/build-system/haskell.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -30,7 +31,9 @@
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
- #:export (%haskell-build-system-modules
+ #:export (hackage-uri
+
+ %haskell-build-system-modules
haskell-build
haskell-build-system))
@@ -41,6 +44,12 @@
;;
;; 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
;; Build-side modules imported by default.
`((guix build haskell-build-system)
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 03881f1..0d5616c 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -40,6 +40,7 @@
#:use-module (guix memoization)
#:use-module (guix upstream)
#:use-module (guix packages)
+ #:autoload (guix build-system haskell) (hackage-uri)
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
#:export (%hackage-url
hackage->guix-package
@@ -303,7 +304,7 @@ the hash of the Cabal file."
(version ,version)
(source (origin
(method url-fetch)
- (uri (string-append ,@(factorize-uri source-url version)))
+ (uri (hackage-uri ,name version))
(sha256
(base32
,(if tarball
@@ -367,7 +368,7 @@ respectively."
(hackage-cabal-url hackage-name))
#f)
((_ *** ("version" (version)))
- (let ((url (hackage-source-url hackage-name version)))
+ (let ((url (hackage-uri hackage-name version)))
(upstream-source
(package (package-name package))
(version version)
diff --git a/tests/hackage.scm b/tests/hackage.scm
index aca8070..ba69466 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -170,10 +170,7 @@ library
('source
('origin
('method 'url-fetch)
- ('uri ('string-append
- "https://hackage.haskell.org/package/foo/foo-"
- 'version
- ".tar.gz"))
+ ('uri ('hackage-uri "foo" 'version))
('sha256
('base32
(? string? hash)))))
@@ -215,10 +212,7 @@ library
('source
('origin
('method 'url-fetch)
- ('uri ('string-append
- "https://hackage.haskell.org/package/foo/foo-"
- 'version
- ".tar.gz"))
+ ('uri ('hackage-uri "foo" 'version))
('sha256
('base32
(? string? hash)))))
@@ -343,10 +337,7 @@ executable cabal
('source
('origin
('method 'url-fetch)
- ('uri ('string-append
- "https://hackage.haskell.org/package/foo/foo-"
- 'version
- ".tar.gz"))
+ ('uri ('hackage-uri "foo" 'version))
('sha256
('base32
(? string? hash)))))
@@ -409,10 +400,7 @@ executable cabal
('source
('origin
('method 'url-fetch)
- ('uri ('string-append
- "https://hackage.haskell.org/package/foo/foo-"
- 'version
- ".tar.gz"))
+ ('uri ('hackage-uri "foo" 'version))
('sha256
('base32
(? string? hash)))))
- branch master updated (1a0696e -> 8cc099b), guix-commits, 2021/12/01
- 01/11: inferior: 'cached-channel-instance' does not cache unauthenticated instances., guix-commits, 2021/12/01
- 03/11: doc: Document LUKS2 GRUB support and shortcomings, guix-commits, 2021/12/01
- 02/11: gnu: system: Add LUKS2 support for the root file system., guix-commits, 2021/12/01
- 04/11: installer: Make LUKS2 the default format for encrypted devices, guix-commits, 2021/12/01
- 05/11: gnu: Add python-codespell., guix-commits, 2021/12/01
- 10/11: gnu: Add libfido2., guix-commits, 2021/12/01
- 08/11: gnu: Add vim-nerdtree., guix-commits, 2021/12/01
- 06/11: gnu: Add smplayer., guix-commits, 2021/12/01
- 07/11: build-system: haskell: Add ‘hackage-uri’ procedure.,
guix-commits <=
- 11/11: gnu: openssh: Add support for ecdsa-sk, ed25519-sk ssh keys., guix-commits, 2021/12/01
- 09/11: gnu: Add libcbor., guix-commits, 2021/12/01