Browse Source

import: github: Use 'json-fetch'.

* guix/import/github.scm (json-fetch*): Remove.
(latest-released-version): Adjust accordingly.
gn-latest-20200428
Ludovic Courtès 5 years ago
parent
commit
62bd24db39
No known key found for this signature in database GPG Key ID: 90B11993D9AEBB5
  1. 15
      guix/import/github.scm

15
guix/import/github.scm

@ -23,23 +23,12 @@
#: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 (web uri)
#:export (%github-updater))
(define (json-fetch* url)
"Return a list/hash representation of the JSON resource URL, or #f on
failure."
(call-with-output-file "/dev/null"
(lambda (null)
(with-error-to-port null
(lambda ()
(call-with-temporary-output-file
(lambda (temp port)
(and (url-fetch url temp)
(call-with-input-file temp json->scm)))))))))
(define (find-extension url)
"Return the extension of the archive e.g. '.tar.gz' given a URL, or
false if none is recognized"
@ -136,7 +125,7 @@ the package e.g. 'bedtools2'. Return #f if there is no releases"
"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…
Cancel
Save