summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <christopher.baines@digital.cabinet-office.gov.uk>2017-04-24 06:36:04 +0100
committerChristopher Baines <christopher.baines@digital.cabinet-office.gov.uk>2018-03-11 15:59:20 +0000
commit6f9b9aadbd1328d9062c73dc33a05c84960ba629 (patch)
tree5090d2191b08ae406c584dd5d5a7c602d137d12b
parentef285359ee1b2a4ffd0bef21ba494358c2f018c0 (diff)
downloadgnu-guix-6f9b9aadbd1328d9062c73dc33a05c84960ba629.tar
gnu-guix-6f9b9aadbd1328d9062c73dc33a05c84960ba629.tar.gz
Alter the GitHub updater to use git tags
Just using tags is the most consistent way of getting releases for GOV.UK related software.
-rw-r--r--guix/import/github.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/guix/import/github.scm b/guix/import/github.scm
index 4b7d53c704..5fd08b14bc 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -140,14 +140,18 @@ repository separated by a forward slash, from a string URL of the form
'https://github.com/arq5x/bedtools2/archive/v2.24.0.tar.gz' and the name of
the package e.g. 'bedtools2'. Return #f if there is no releases"
(let* ((token (%github-token))
- (api-url (string-append
+ (releases-api-url (string-append
"https://api.github.com/repos/"
(github-user-slash-repository url)
"/releases"))
+ (tags-api-url (string-append
+ "https://api.github.com/repos/"
+ (github-user-slash-repository url)
+ "/tags"))
(json (json-fetch*
(if token
- (string-append api-url "?access_token=" token)
- api-url))))
+ (string-append tags-api-url "?access_token=" token)
+ tags-api-url))))
(if (eq? json #f)
(if token
(error "Error downloading release information through the GitHub
@@ -163,13 +167,17 @@ https://github.com/settings/tokens"))
;; https://github.com/wwood/OrfM/releases/tag/v0.5.1
;; or an all-prerelease set
;; https://github.com/powertab/powertabeditor/releases
- (not (hash-ref x "prerelease")))
+ (and (not (hash-ref x "prerelease"))
+ (string-prefix? "release_"
+ (or (hash-ref x "tag_name")
+ (hash-ref x "name")))))
json)))
(match proper-releases
(() ;empty release list
#f)
((release . rest) ;one or more releases
- (let ((tag (hash-ref release "tag_name"))
+ (let ((tag (or (hash-ref release "tag_name")
+ (hash-ref release "name")))
(name-length (string-length package-name)))
;; some tags include the name of the package e.g. "fdupes-1.51"
;; so remove these