GNU bug report logs -
#51570
[PATCH] build-system: haskell: Add ‘hackage-uri’ procedure.
Previous Next
Reported by: Xinglu Chen <public <at> yoctocell.xyz>
Date: Tue, 2 Nov 2021 16:49:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51570 in the body.
You can then email your comments to 51570 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#51570
; Package
guix-patches
.
(Tue, 02 Nov 2021 16:49:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Xinglu Chen <public <at> yoctocell.xyz>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 02 Nov 2021 16:49:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* 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 <at> fbengineering.ch>
;;; Copyright © 2020 Timothy Sample <samplet <at> ngyro.com>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune <at> gmail.com>
+;;; Copyright © 2021 Xinglu Chen <public <at> 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
Information forwarded
to
guix-patches <at> gnu.org
:
bug#51570
; Package
guix-patches
.
(Wed, 03 Nov 2021 10:30:03 GMT)
Full text and
rfc822 format available.
Message #8 received at 51570 <at> debbugs.gnu.org (full text, mbox):
Hi,
Thanks for this helpful patch.
On Tue, 2 Nov 2021 at 17:49, Xinglu Chen <public <at> yoctocell.xyz> wrote:
> +(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"))
It seems the correct way. Aside this change for future imports from
Hackage, does it make sense to replace the current 'string-append' in
all package definitions by this 'hackage-uri'?
Cheers,
simon
Information forwarded
to
guix-patches <at> gnu.org
:
bug#51570
; Package
guix-patches
.
(Fri, 05 Nov 2021 11:54:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 51570 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
On Wed, Nov 03 2021, zimoun wrote:
> Hi,
>
> Thanks for this helpful patch.
You are welcome! :-)
> On Tue, 2 Nov 2021 at 17:49, Xinglu Chen <public <at> yoctocell.xyz> wrote:
>
>> +(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"))
>
> It seems the correct way. Aside this change for future imports from
> Hackage, does it make sense to replace the current 'string-append' in
> all package definitions by this 'hackage-uri'?
That would be nice, but I don’t know of a way to automate this; maybe
you have some ideas? :-)
[signature.asc (application/pgp-signature, inline)]
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Wed, 01 Dec 2021 15:33:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Xinglu Chen <public <at> yoctocell.xyz>
:
bug acknowledged by developer.
(Wed, 01 Dec 2021 15:33:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 51570-done <at> debbugs.gnu.org (full text, mbox):
Hi,
Xinglu Chen <public <at> yoctocell.xyz> skribis:
> * 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.
[...]
> +(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"))
Applied, but I also exported ‘hackage-uri’ so that it’s more useful.
:-)
Thanks,
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 30 Dec 2021 12:24:13 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 79 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.