From: Xinglu Chen <public@yoctocell.xyz>
To: 51570@debbugs.gnu.org
Subject: [bug#51570] [PATCH] build-system: haskell: Add ‘hackage-uri’ procedure.
Date: Tue, 02 Nov 2021 17:48:09 +0100 [thread overview]
Message-ID: <30e3db0aca5699b7d42f7107723e9dde4f16a5f7.1635871607.git.public@yoctocell.xyz> (raw)
* 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.
---
guix/build-system/haskell.scm | 7 +++++++
guix/import/hackage.scm | 4 ++--
tests/hackage.scm | 20 ++++----------------
3 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm
index 18a584f782..48f3452931 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.
;;;
@@ -41,6 +42,12 @@ (define-module (guix build-system haskell)
;;
;; 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 03881f1a3d..51581f15d7 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -303,7 +303,7 @@ (define (maybe-arguments)
(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 +367,7 @@ (define (latest-release package)
(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 aca807027c..ba694661f3 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -170,10 +170,7 @@ (define-package-matcher match-ghc-foo
('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 @@ (define-package-matcher match-ghc-foo-6
('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 @@ (define-package-matcher match-ghc-foo-revision
('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 @@ (define-package-matcher match-ghc-foo-import
('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)))))
base-commit: 0e19713c1fbfd3a01347e0d490434a53a596ed3c
--
2.33.0
next reply other threads:[~2021-11-02 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-02 16:48 Xinglu Chen [this message]
2021-11-03 10:29 ` [bug#51570] [PATCH] build-system: haskell: Add ‘hackage-uri’ procedure zimoun
2021-11-05 11:52 ` Xinglu Chen
2021-12-01 15:32 ` bug#51570: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30e3db0aca5699b7d42f7107723e9dde4f16a5f7.1635871607.git.public@yoctocell.xyz \
--to=public@yoctocell.xyz \
--cc=51570@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.