Skip to content
Snippets Groups Projects
Unverified Commit 59a47fb6 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

gnu-maintenance: 'kernel.org' and 'savannah' updaters rewrite URLs.

This makes sure they return 'mirror://' URLs rather that URLs pointing
to the specific mirror they talk to.

* guix/gnu-maintenance.scm (url-prefix-rewrite)
(adjusted-upstream-source): New procedures.
(latest-savannah-release, latest-kernel.org-release): Use it.
parent 1c26219f
No related branches found
No related tags found
No related merge requests found
...@@ -615,6 +615,22 @@ (define (pure-gnu-package? package) ...@@ -615,6 +615,22 @@ (define (pure-gnu-package? package)
(define gnu-hosted? (define gnu-hosted?
(url-prefix-predicate "mirror://gnu/")) (url-prefix-predicate "mirror://gnu/"))
(define (url-prefix-rewrite old new)
"Return a one-argument procedure that rewrites URL prefix OLD to NEW."
(lambda (url)
(if (string-prefix? old url)
(string-append new (string-drop url (string-length old)))
url)))
(define (adjusted-upstream-source source rewrite-url)
"Rewrite URLs in SOURCE by apply REWRITE-URL to each of them."
(upstream-source
(inherit source)
(urls (map rewrite-url (upstream-source-urls source)))
(signature-urls (and=> (upstream-source-signature-urls source)
(lambda (urls)
(map rewrite-url urls))))))
(define savannah-package? (define savannah-package?
(url-prefix-predicate "mirror://savannah/")) (url-prefix-predicate "mirror://savannah/"))
...@@ -628,10 +644,13 @@ (define (latest-savannah-release package) ...@@ -628,10 +644,13 @@ (define (latest-savannah-release package)
"Return the latest release of PACKAGE." "Return the latest release of PACKAGE."
(let* ((uri (string->uri (origin-uri (package-source package)))) (let* ((uri (string->uri (origin-uri (package-source package))))
(package (package-upstream-name package)) (package (package-upstream-name package))
(directory (dirname (uri-path uri)))) (directory (dirname (uri-path uri)))
(latest-html-release package (rewrite (url-prefix-rewrite %savannah-base
#:base-url %savannah-base "mirror://savannah")))
#:directory directory))) (adjusted-upstream-source (latest-html-release package
#:base-url %savannah-base
#:directory directory)
rewrite)))
(define (latest-xorg-release package) (define (latest-xorg-release package)
"Return the latest release of PACKAGE." "Return the latest release of PACKAGE."
...@@ -655,11 +674,15 @@ (define (file->signature file) ...@@ -655,11 +674,15 @@ (define (file->signature file)
(let* ((uri (string->uri (origin-uri (package-source package)))) (let* ((uri (string->uri (origin-uri (package-source package))))
(package (package-upstream-name package)) (package (package-upstream-name package))
(directory (dirname (uri-path uri)))) (directory (dirname (uri-path uri)))
(latest-html-release package (rewrite (url-prefix-rewrite %kernel.org-base
#:base-url %kernel.org-base "mirror://kernel.org")))
#:directory directory (adjusted-upstream-source (latest-html-release package
#:file->signature file->signature))) #:base-url %kernel.org-base
#:directory directory
#:file->signature
file->signature)
rewrite)))
(define %gnu-updater (define %gnu-updater
;; This is for everything at ftp.gnu.org. ;; This is for everything at ftp.gnu.org.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment