mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
import: github: Fix regression on the /releases retrieval.
Fixes a regression introduced in
62bd24db39
, which introduced a call to
'hash-table->alist'.
* guix/import/github.scm (json-fetch*): New procedure.
(latest-released-version): Use it.
This commit is contained in:
parent
6d30b1b2ca
commit
4cd5ec801b
1 changed files with 14 additions and 2 deletions
|
@ -19,16 +19,28 @@
|
|||
(define-module (guix import github)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (json)
|
||||
#:use-module (guix utils)
|
||||
#:use-module ((guix download) #:prefix download:)
|
||||
#:use-module (guix import utils)
|
||||
#:use-module (guix import json)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix upstream)
|
||||
#:use-module (guix http-client)
|
||||
#:use-module (web uri)
|
||||
#:export (%github-updater))
|
||||
|
||||
(define (json-fetch* url)
|
||||
"Return a representation of the JSON resource URL (a list or hash table), or
|
||||
#f if URL returns 404."
|
||||
(guard (c ((and (http-get-error? c)
|
||||
(= 404 (http-get-error-code c)))
|
||||
#f)) ;"expected" if package is unknown
|
||||
(let* ((port (http-fetch url))
|
||||
(result (json->scm port)))
|
||||
(close-port port)
|
||||
result)))
|
||||
|
||||
(define (find-extension url)
|
||||
"Return the extension of the archive e.g. '.tar.gz' given a URL, or
|
||||
false if none is recognized"
|
||||
|
@ -125,7 +137,7 @@ (define (latest-released-version url package-name)
|
|||
"https://api.github.com/repos/"
|
||||
(github-user-slash-repository url)
|
||||
"/releases"))
|
||||
(json (json-fetch
|
||||
(json (json-fetch*
|
||||
(if token
|
||||
(string-append api-url "?access_token=" token)
|
||||
api-url))))
|
||||
|
|
Loading…
Reference in a new issue