From 6f9b9aadbd1328d9062c73dc33a05c84960ba629 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 24 Apr 2017 06:36:04 +0100 Subject: Alter the GitHub updater to use git tags Just using tags is the most consistent way of getting releases for GOV.UK related software. --- guix/import/github.scm | 18 +++++++++++++----- 1 file 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 -- cgit v1.2.3