mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-27 14:52:05 -05:00
import: launchpad: Allow updating to a specific version.
* guix/import/launchpad.scm (latest-release): Rename to 'import-release', add #:version argument. If version is given, return an upstream-source for this version.
This commit is contained in:
parent
424a871f1f
commit
3986caacae
1 changed files with 6 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
||||||
;;; Copyright © 2019, 2020 Arun Isaac <arunisaac@systemreboot.net>
|
;;; Copyright © 2019, 2020 Arun Isaac <arunisaac@systemreboot.net>
|
||||||
;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
|
;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
|
||||||
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
||||||
|
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -121,8 +122,9 @@ (define (pre-release? x)
|
||||||
(last (remove pre-release? (vector->list (assoc-ref json "entries"))))
|
(last (remove pre-release? (vector->list (assoc-ref json "entries"))))
|
||||||
"version"))))
|
"version"))))
|
||||||
|
|
||||||
(define (latest-release pkg)
|
(define* (import-release pkg #:key (version #f))
|
||||||
"Return an <upstream-source> for the latest release of PKG."
|
"Return an <upstream-source> for the latest release of PKG. Optionally
|
||||||
|
include a VERSION string to fetch a specific version."
|
||||||
(define (origin-launchpad-uri origin)
|
(define (origin-launchpad-uri origin)
|
||||||
(match (origin-uri origin)
|
(match (origin-uri origin)
|
||||||
((? string? url) url) ; surely a Launchpad URL
|
((? string? url) url) ; surely a Launchpad URL
|
||||||
|
@ -132,7 +134,7 @@ (define (origin-launchpad-uri origin)
|
||||||
(let* ((source-uri (origin-launchpad-uri (package-source pkg)))
|
(let* ((source-uri (origin-launchpad-uri (package-source pkg)))
|
||||||
(name (package-name pkg))
|
(name (package-name pkg))
|
||||||
(repository (launchpad-repository source-uri))
|
(repository (launchpad-repository source-uri))
|
||||||
(newest-version (latest-released-version repository)))
|
(newest-version (or version (latest-released-version repository))))
|
||||||
(if newest-version
|
(if newest-version
|
||||||
(upstream-source
|
(upstream-source
|
||||||
(package name)
|
(package name)
|
||||||
|
@ -145,4 +147,4 @@ (define %launchpad-updater
|
||||||
(name 'launchpad)
|
(name 'launchpad)
|
||||||
(description "Updater for Launchpad packages")
|
(description "Updater for Launchpad packages")
|
||||||
(pred launchpad-package?)
|
(pred launchpad-package?)
|
||||||
(import latest-release)))
|
(import import-release)))
|
||||||
|
|
Loading…
Reference in a new issue