diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-08-17 22:50:58 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-08-17 23:18:11 +0200 |
commit | 0ea009db9d3bf53e75be8faef77c18d39c87a16a (patch) | |
tree | e2fe54757637a7cd727949d5c5977786cb19df5e | |
parent | 4496ea74aaf9d2497ac3eaf8f780a250bed24503 (diff) | |
download | patches-0ea009db9d3bf53e75be8faef77c18d39c87a16a.tar patches-0ea009db9d3bf53e75be8faef77c18d39c87a16a.tar.gz |
upstream: Gracefully handle archive type changes.
Previously, if the currently used archive type (e.g., "bz2") was
unavailable for the new version, 'guix refresh -u' would crash instead
of updating to the archive with the new type.
* guix/upstream.scm (package-update/url-fetch): When URL is #f, pick the
first of URLS; likewise for SIGNATURE-URL.
-rw-r--r-- | guix/upstream.scm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/guix/upstream.scm b/guix/upstream.scm index 1326b3db95..d4f9c5bb45 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -362,6 +362,7 @@ SOURCE, an <upstream-source>." (_ "gz"))) ((url signature-url) + ;; Try to find a URL that matches ARCHIVE-TYPE. (find2 (lambda (url sig-url) ;; Some URIs lack a file extension, like ;; 'https://crates.io/???/0.1/download'. In that @@ -370,7 +371,13 @@ SOURCE, an <upstream-source>." (string-suffix? archive-type url))) urls (or signature-urls (circular-list #f))))) - (let ((tarball (download-tarball store url signature-url + ;; If none of URLS matches ARCHIVE-TYPE, then URL is #f; in that case, + ;; pick up the first element of URLS. + (let ((tarball (download-tarball store + (or url (first urls)) + (and (pair? signature-urls) + (or signature-url + (first signature-urls))) #:key-download key-download))) (values version tarball source)))))) |