guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/05: upstream: Gracefully handle archive type changes.


From: guix-commits
Subject: 03/05: upstream: Gracefully handle archive type changes.
Date: Sat, 17 Aug 2019 17:18:26 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 0ea009db9d3bf53e75be8faef77c18d39c87a16a
Author: Ludovic Courtès <address@hidden>
Date:   Sat Aug 17 22:50:58 2019 +0200

    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 1326b3d..d4f9c5b 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))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]