summaryrefslogtreecommitdiff
path: root/guix/import
diff options
context:
space:
mode:
authorAlex Sassmannshausen <alex@pompo.co>2016-07-02 20:06:02 +0200
committerLudovic Courtès <ludo@gnu.org>2016-07-03 23:58:29 +0200
commit5b8e564ccdc734cda20d151adc1d60d7119fff3b (patch)
tree109b03ddf7319126bf00371989706009624f46e3 /guix/import
parent679b535b03ff2c9408ebfaa3baae70736c8455ec (diff)
import: cpan: Use our mirrors for 'https' URLs.
* 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. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/import')
-rw-r--r--guix/import/cpan.scm13
1 files changed, 9 insertions, 4 deletions
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index ad61ee7916..213a155fd6 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))))