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>
This commit is contained in:
Alex Sassmannshausen 2016-07-02 20:06:02 +02:00 committed by Ludovic Courtès
parent 679b535b03
commit 5b8e564ccd
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 20 additions and 4 deletions

View file

@ -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")