From 0ea009db9d3bf53e75be8faef77c18d39c87a16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 17 Aug 2019 22:50:58 +0200 Subject: 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. --- guix/upstream.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 ." (_ "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 ." (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)))))) -- cgit v1.2.3