diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-11-13 22:26:07 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-11-14 21:34:07 +0100 |
commit | ee2cfdfe86b0ba7de0312592cbfb96ea175e8863 (patch) | |
tree | a0e80901a034ae226ea7111fbaecbee26d2f3b5a /guix | |
parent | e921993c25626541385f191f0463cad8e5e5c5c7 (diff) | |
download | gnu-guix-ee2cfdfe86b0ba7de0312592cbfb96ea175e8863.tar gnu-guix-ee2cfdfe86b0ba7de0312592cbfb96ea175e8863.tar.gz |
download: Add Software Heritage as a content-addressed mirror.
* guix/download.scm (%content-addressed-mirrors): Add Software
Heritage.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/download.scm | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/guix/download.scm b/guix/download.scm index 988117885c..b74fd31c1f 100644 --- a/guix/download.scm +++ b/guix/download.scm @@ -373,18 +373,28 @@ ;; procedure that takes a file name, an algorithm (symbol) and a hash ;; (bytevector), and returns a URL or #f. ;; Note: Avoid 'https' to mitigate <http://bugs.gnu.org/22774>. - ;; TODO: Add more. - '(list (lambda (file algo hash) - ;; Files served by 'guix publish' are accessible under a single - ;; hash algorithm. - (string-append "http://mirror.hydra.gnu.org/file/" - file "/" (symbol->string algo) "/" - (bytevector->nix-base32-string hash))) - (lambda (file algo hash) - ;; 'tarballs.nixos.org' supports several algorithms. - (string-append "http://tarballs.nixos.org/" - (symbol->string algo) "/" - (bytevector->nix-base32-string hash))))) + '(begin + (use-modules (guix base32) (guix base16)) + + (list (lambda (file algo hash) + ;; Files served by 'guix publish' are accessible under a single + ;; hash algorithm. + (string-append "http://mirror.hydra.gnu.org/file/" + file "/" (symbol->string algo) "/" + (bytevector->nix-base32-string hash))) + (lambda (file algo hash) + ;; 'tarballs.nixos.org' supports several algorithms. + (string-append "http://tarballs.nixos.org/" + (symbol->string algo) "/" + (bytevector->nix-base32-string hash))) + (lambda (file algo hash) + ;; Software Heritage usually archives VCS history rather than + ;; tarballs, but tarballs are sometimes available (and can be + ;; explicitly stored there.) For example, see + ;; <https://archive.softwareheritage.org/api/1/content/sha256:92d0fa1c311cacefa89853bdb53c62f4110cdfda3820346b59cbd098f40f955e/>. + (string-append "http://archive.softwareheritage.org/api/1/content/" + (symbol->string algo) ":" + (bytevector->base16-string hash) "/raw/"))))) (define %content-addressed-mirror-file ;; Content-addressed mirrors stored in a file. |