aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2017-12-19 17:57:15 +0100
committerLudovic Courtès <ludo@gnu.org>2017-12-19 18:16:47 +0100
commit618f0582b49edb0a5f633c953b00fc93d03c077a (patch)
treefa23df56614f71d96673383b53654cce2df7f241
parent68f1869cfca63ee361b2b036eb424f20a9da0d91 (diff)
downloadguix-618f0582b49edb0a5f633c953b00fc93d03c077a.tar
guix-618f0582b49edb0a5f633c953b00fc93d03c077a.tar.gz
upstream: Reject bogus archive type guesses.
This would crash 'guix refresh -u' with source URLs ending in "…/v1.2.3". * guix/upstream.scm (package-update): Be stricter when determining ARCHIVE-TYPE.
-rw-r--r--guix/upstream.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 0fe3308876..caaa0e44e4 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -278,7 +278,13 @@ and 'interactive' (default)."
((archive-type)
(match (and=> (package-source package) origin-uri)
((? string? uri)
- (file-extension (basename uri)))
+ (let ((type (file-extension (basename uri))))
+ ;; Sometimes we have URLs such as
+ ;; "https://github.com/…/tarball/v0.1", in which case
+ ;; we must not consider "1" as the extension.
+ (and (or (string-contains type "z")
+ (string=? type "tar"))
+ type)))
(_
"gz")))
((url signature-url)