download: Prepare to support the 'guix publish' /file URLs.

* guix/download.scm (%content-addressed-mirrors): Add 'file' parameter
to the lambda.
* guix/build/download.scm (url-fetch)[content-addressed-uris]: Adjust
accordingly.
This commit is contained in:
Ludovic Courtès 2016-07-20 17:00:50 +02:00
parent ff6638d112
commit ab84b927ef
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 4 additions and 4 deletions

View file

@ -737,7 +737,7 @@ (define content-addressed-uris
(append-map (lambda (make-url)
(filter-map (match-lambda
((hash-algo . hash)
(string->uri (make-url hash-algo hash))))
(string->uri (make-url file hash-algo hash))))
hashes))
content-addressed-mirrors))

View file

@ -232,10 +232,10 @@ (define %mirror-file
(define %content-addressed-mirrors
;; List of content-addressed mirrors. Each mirror is represented as a
;; procedure that takes an algorithm (symbol) and a hash (bytevector), and
;; returns a URL or #f.
;; procedure that takes a file name, an algorithm (symbol) and a hash
;; (bytevector), and returns a URL or #f.
;; TODO: Add more.
'(list (lambda (algo hash)
'(list (lambda (file algo hash)
;; 'tarballs.nixos.org' supports several algorithms.
(string-append "http://tarballs.nixos.org/"
(symbol->string algo) "/"