import: github: Better tolerate unexpected file extensions.

* guix/import/github.scm (find-extension): Add ".tbz".
(updated-github-url): When 'find-extension' returns #f, use "" for EXT.
This commit is contained in:
Ludovic Courtès 2017-01-27 23:49:52 +01:00
parent 6715e1ff2e
commit 21f4a7c116
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 3 additions and 2 deletions

View File

@ -49,7 +49,8 @@
"Return the extension of the archive e.g. '.tar.gz' given a URL, or "Return the extension of the archive e.g. '.tar.gz' given a URL, or
false if none is recognized" false if none is recognized"
(find (lambda (x) (string-suffix? x url)) (find (lambda (x) (string-suffix? x url))
(list ".tar.gz" ".tar.bz2" ".tar.xz" ".zip" ".tar" ".tgz" ".love"))) (list ".tar.gz" ".tar.bz2" ".tar.xz" ".zip" ".tar"
".tgz" ".tbz" ".love")))
(define (updated-github-url old-package new-version) (define (updated-github-url old-package new-version)
;; Return a url for the OLD-PACKAGE with NEW-VERSION. If no source url in ;; Return a url for the OLD-PACKAGE with NEW-VERSION. If no source url in
@ -57,7 +58,7 @@ false if none is recognized"
(define (updated-url url) (define (updated-url url)
(if (string-prefix? "https://github.com/" url) (if (string-prefix? "https://github.com/" url)
(let ((ext (find-extension url)) (let ((ext (or (find-extension url) ""))
(name (package-name old-package)) (name (package-name old-package))
(version (package-version old-package)) (version (package-version old-package))
(prefix (string-append "https://github.com/" (prefix (string-append "https://github.com/"