* [PATCH] Fix cpan importer source-url generator.
@ 2016-07-02 18:06 Alex Sassmannshausen
2016-07-02 18:06 ` [PATCH] import: cpan: Use our mirrors for 'https' URLs Alex Sassmannshausen
0 siblings, 1 reply; 3+ messages in thread
From: Alex Sassmannshausen @ 2016-07-02 18:06 UTC (permalink / raw)
To: guix-devel
Hello,
Currently the CPAN importer correctly replaces metacpan URLs with our mirrors
when the provided metacpan URL is 'http'. This patch fixes the importer to
also 'fix' the URLs when they are 'https'.
Feedback welcome,
Alex
Alex Sassmannshausen (1):
import: cpan: Use our mirrors for 'https' URLs.
guix/import/cpan.scm | 13 +++++++++----
tests/cpan.scm | 11 +++++++++++
2 files changed, 20 insertions(+), 4 deletions(-)
--
2.8.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] import: cpan: Use our mirrors for 'https' URLs.
2016-07-02 18:06 [PATCH] Fix cpan importer source-url generator Alex Sassmannshausen
@ 2016-07-02 18:06 ` Alex Sassmannshausen
2016-07-03 22:00 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Alex Sassmannshausen @ 2016-07-02 18:06 UTC (permalink / raw)
To: guix-devel
* guix/import/cpan.scm (fix-source-url): New procedure.
(cpan-module->sexp): Use it to construct our source-url.
* tests/cpan.scm: Add tests for fix-source-url.
---
guix/import/cpan.scm | 13 +++++++++----
tests/cpan.scm | 11 +++++++++++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index ad61ee7..213a155 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2016 Alex Sassmannshausen <alex@pompo.co>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -99,6 +100,13 @@ or #f on failure. MODULE should be e.g. \"Test::Script\""
(define (cpan-home name)
(string-append "http://search.cpan.org/dist/" name))
+(define (fix-source-url download-url)
+ "Return a new download URL based on DOWNLOAD-URL which now uses our mirrors,
+if the original's domain was metacpan."
+ (regexp-substitute/global #f "http[s]?://cpan.metacpan.org" download-url
+ 'pre "mirror://cpan" 'post))
+
+
(define %corelist
(delay
(let* ((perl (with-store store
@@ -183,10 +191,7 @@ META."
(list (list guix-name
(list 'quasiquote inputs))))))
- (define source-url
- (regexp-substitute/global #f "http://cpan.metacpan.org"
- (assoc-ref meta "download_url")
- 'pre "mirror://cpan" 'post))
+ (define source-url (fix-source-url (assoc-ref meta "download_url")))
(let ((tarball (with-store store
(download-to-store store source-url))))
diff --git a/tests/cpan.scm b/tests/cpan.scm
index 5d56f0b..898081b 100644
--- a/tests/cpan.scm
+++ b/tests/cpan.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2016 Alex Sassmannshausen <alex@pompo.co>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -97,4 +98,14 @@
(x
(pk 'fail x #f)))))
+(test-equal "source-url-http"
+ ((@@ (guix import cpan) fix-source-url)
+ "http://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
+ "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
+
+(test-equal "source-url-https"
+ ((@@ (guix import cpan) fix-source-url)
+ "https://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
+ "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
+
(test-end "cpan")
--
2.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] import: cpan: Use our mirrors for 'https' URLs.
2016-07-02 18:06 ` [PATCH] import: cpan: Use our mirrors for 'https' URLs Alex Sassmannshausen
@ 2016-07-03 22:00 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2016-07-03 22:00 UTC (permalink / raw)
To: Alex Sassmannshausen; +Cc: guix-devel
Alex Sassmannshausen <alex@pompo.co> skribis:
> * guix/import/cpan.scm (fix-source-url): New procedure.
> (cpan-module->sexp): Use it to construct our source-url.
> * tests/cpan.scm: Add tests for fix-source-url.
Applied, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-03 22:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-02 18:06 [PATCH] Fix cpan importer source-url generator Alex Sassmannshausen
2016-07-02 18:06 ` [PATCH] import: cpan: Use our mirrors for 'https' URLs Alex Sassmannshausen
2016-07-03 22:00 ` Ludovic Courtès
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.