diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-09-14 10:11:42 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-09-14 11:50:58 +0200 |
commit | 3cb5ae8577db28b2c6013b9d9ecf99cb696e3432 (patch) | |
tree | 4430363dcf7e1b9b7589d6d86d360c6d7fd97b13 /guix/build/download.scm | |
parent | 67da64608773772f75983415dd90584025ecd523 (diff) |
download: Disarchive mirrors can be URL-returning procedures.
As discussed at <https://issues.guix.gnu.org/47336#16>.
* guix/build/download.scm (url-fetch)[disarchive-uris]: Accept MIRROR as
a procedure.
* guix/download.scm (%disarchive-mirrors): Add comment. This change can
only be made once a 'guix perform-download' that understands procedures
is widely deployed.
Diffstat (limited to 'guix/build/download.scm')
-rw-r--r-- | guix/build/download.scm | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/guix/build/download.scm b/guix/build/download.scm index 54627eefa2..c8ddadfdd4 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -747,15 +747,20 @@ otherwise simply ignore them." content-addressed-mirrors)) (define disarchive-uris - (append-map (match-lambda - ((? string? mirror) - (map (match-lambda - ((hash-algo . hash) - (string->uri - (string-append mirror - (symbol->string hash-algo) "/" - (bytevector->base16-string hash))))) - hashes))) + (append-map (lambda (mirror) + (let ((make-url (match mirror + ((? string?) + (lambda (hash-algo hash) + (string-append + mirror + (symbol->string hash-algo) "/" + (bytevector->base16-string hash)))) + ((? procedure?) + mirror)))) + (map (match-lambda + ((hash-algo . hash) + (string->uri (make-url hash-algo hash)))) + hashes))) disarchive-mirrors)) ;; Make this unbuffered so 'progress-report/file' works as expected. 'line |