aboutsummaryrefslogtreecommitdiff
path: root/guix/import
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-10-27 14:38:45 -0700
committerLudovic Courtès <ludo@gnu.org>2017-10-28 09:45:54 +0200
commit90297811a9d6412fcf57bd6bef08ded39ac895cc (patch)
treeec9e5a1c8b3e458e66be69946cbc3a2ea96e9e7b /guix/import
parent6d6d19322124dcd963e801453ed026620634d0b3 (diff)
downloadgnu-guix-90297811a9d6412fcf57bd6bef08ded39ac895cc.tar
gnu-guix-90297811a9d6412fcf57bd6bef08ded39ac895cc.tar.gz
import: github: Gracefully handle multiple-URL origins.
* guix/import/github.scm (latest-release)[origin-github-uri]: New procedure. Use it.
Diffstat (limited to 'guix/import')
-rw-r--r--guix/import/github.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/guix/import/github.scm b/guix/import/github.scm
index b249b39067..4b7d53c704 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,6 +20,7 @@
(define-module (guix import github)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (json)
#:use-module (guix utils)
@@ -182,7 +184,14 @@ https://github.com/settings/tokens"))
(define (latest-release pkg)
"Return an <upstream-source> for the latest release of PKG."
- (let* ((source-uri (origin-uri (package-source pkg)))
+ (define (origin-github-uri origin)
+ (match (origin-uri origin)
+ ((? string? url)
+ url) ;surely a github.com URL
+ ((urls ...)
+ (find (cut string-contains <> "github.com") urls))))
+
+ (let* ((source-uri (origin-github-uri (package-source pkg)))
(name (package-name pkg))
(newest-version (latest-released-version source-uri name)))
(if newest-version