diff options
author | Christopher Baines <christopher.baines@digital.cabinet-office.gov.uk> | 2017-04-24 06:36:04 +0100 |
---|---|---|
committer | Christopher Baines <christopher.baines@digital.cabinet-office.gov.uk> | 2017-10-08 18:16:42 +0100 |
commit | 4549d7d743f0d348d9c95bdca1e269cc880bdfdd (patch) | |
tree | b98fe68e5ea80dfa83db4060efca0e4bbaa0b77a | |
parent | d4f57e2d8d0dbb1e1050b8532e4c0603b8f278bd (diff) | |
download | gnu-guix-4549d7d743f0d348d9c95bdca1e269cc880bdfdd.tar gnu-guix-4549d7d743f0d348d9c95bdca1e269cc880bdfdd.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.scm | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/guix/import/github.scm b/guix/import/github.scm index b249b39067..ea47043692 100644 --- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -138,14 +138,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 @@ -161,13 +165,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 |