summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2021-09-17 11:09:04 +0200
committerLars-Dominik Braun <lars@6xq.net>2021-10-08 09:13:52 +0200
commitedd912a128cf467050c1a76a021d91ea8b90e759 (patch)
tree06d82bd2707c6834d1f6c48f5ed3bf630cc10a1d
parenta01daed62c24d62e8350ce15d7a19aed37289807 (diff)
downloadguix-edd912a128cf467050c1a76a021d91ea8b90e759.tar.gz
import: hackage: Support mirror:// URLs
* guix/import/hackage.scm (guix-package->hackage-name): Support
mirror://-style URI’s.
(hackage-package?): Ditto.
-rw-r--r--guix/import/hackage.scm6
1 files changed, 3 insertions, 3 deletions
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 0a10c421bb..03881f1a3d 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -121,12 +121,12 @@ version is returned."
       (string-append package-name-prefix (string-downcase name))))
 
 (define guix-package->hackage-name
-  (let ((uri-rx (make-regexp "https?://hackage.haskell.org/package/([^/]+)/.*"))
+  (let ((uri-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage)/package/([^/]+)/.*"))
         (name-rx (make-regexp "(.*)-[0-9\\.]+")))
     (lambda (package)
       "Given a Guix package name, return the corresponding Hackage name."
       (let* ((source-url (and=> (package-source package) origin-uri))
-             (name (match:substring (regexp-exec uri-rx source-url) 1)))
+             (name (match:substring (regexp-exec uri-rx source-url) 2)))
         (match (regexp-exec name-rx name)
           (#f name)
           (m (match:substring m 1)))))))
@@ -353,7 +353,7 @@ respectively."
                     #:guix-name hackage-name->package-name))
 
 (define hackage-package?
-  (let ((hackage-rx (make-regexp "https?://hackage.haskell.org")))
+  (let ((hackage-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage/)")))
     (url-predicate (cut regexp-exec hackage-rx <>))))
 
 (define (latest-release package)