guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 01/12] upstream: Use a the first url from urls when find2 ret


From: Ludovic Courtès
Subject: Re: [PATCH 01/12] upstream: Use a the first url from urls when find2 returns #f.
Date: Tue, 13 Dec 2016 23:22:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

David Craven <address@hidden> skribis:

>> Thanks, and sorry for taking long for just one line!
>
> No problem. That's what code reviews are for...
>
> I removed my change and inserted
>        (display urls)
>        (display signature-urls)
>        (display url)
>        (display signature-url)
>
> here are the results:
>
> urls: (https://crates.io/api/v1/crates/libc/0.2.18/download)
> signature-urls: #f
> url: #f
> signature-url: #f

Got it.  What about this change:

diff --git a/guix/upstream.scm b/guix/upstream.scm
index 8685afd..e069cc2 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -241,12 +241,16 @@ and 'interactive' (default)."
                    ((archive-type)
                     (match (and=> (package-source package) origin-uri)
                       ((? string? uri)
-                       (or (file-extension uri) "gz"))
+                       (file-extension uri))
                       (_
                        "gz")))
                    ((url signature-url)
                     (find2 (lambda (url sig-url)
-                             (string-suffix? archive-type url))
+                             ;; Some URIs lack a file extension, like
+                             ;; 'https://crates.io/…/0.1/download'.  In that
+                             ;; case, pick the first URL.
+                             (or (not archive-type)
+                                 (string-suffix? archive-type url)))
                            urls
                            (or signature-urls (circular-list #f)))))
        (let ((tarball (download-tarball store url signature-url
?

The root cause was that the thing would expect a “gz” extension when it
couldn’t find an extension.

If that works for you, feel free to push!

Thanks,
Ludo’.

reply via email to

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