summaryrefslogtreecommitdiff
path: root/guix/import/github.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-08-26 18:35:14 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-08-26 18:35:14 +0200
commit17dddeeee560527a8f30d37761949d658056cb09 (patch)
tree15b0b19c55787f556eb9b42c28d173bddc5435db /guix/import/github.scm
parent331a09654eb7e9f6212b7e8469077fa7393e8b11 (diff)
parent6a9581741e4ee81226aeb2f1c997df76670a6aab (diff)
downloadguix-patches-17dddeeee560527a8f30d37761949d658056cb09.tar
guix-patches-17dddeeee560527a8f30d37761949d658056cb09.tar.gz
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'guix/import/github.scm')
-rw-r--r--guix/import/github.scm23
1 files changed, 17 insertions, 6 deletions
diff --git a/guix/import/github.scm b/guix/import/github.scm
index 95a792d0ca..888b148ffb 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -26,10 +26,13 @@
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (guix utils)
+ #:use-module (guix i18n)
+ #:use-module (guix diagnostics)
#:use-module ((guix download) #:prefix download:)
#:use-module ((guix git-download) #:prefix download:)
#:use-module (guix import utils)
#:use-module (guix import json)
+ #:use-module (json)
#:use-module (guix packages)
#:use-module (guix upstream)
#:use-module (guix http-client)
@@ -162,12 +165,20 @@ empty list."
`((Authorization . ,(string-append "token " (%github-token))))
'())))
- (match (json-fetch release-url #:headers headers)
- (#()
- ;; We got the empty list, presumably because the user didn't use GitHub's
- ;; "release" mechanism, but hopefully they did use Git tags.
- (json-fetch tag-url #:headers headers))
- (x x)))
+ (guard (c ((and (http-get-error? c)
+ (= 404 (http-get-error-code c)))
+ (warning (G_ "~a is unreachable (~a)~%")
+ release-url (http-get-error-code c))
+ '#())) ;return an empty release set
+ (let* ((port (http-fetch release-url #:headers headers))
+ (result (json->scm port)))
+ (close-port port)
+ (match result
+ (#()
+ ;; We got the empty list, presumably because the user didn't use GitHub's
+ ;; "release" mechanism, but hopefully they did use Git tags.
+ (json-fetch tag-url #:headers headers))
+ (x x)))))
(define (latest-released-version url package-name)
"Return a string of the newest released version name given a string URL like