summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2022-06-28 19:15:04 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2022-12-26 17:38:03 +0100
commit7c4aab1f7ddfff5959d45e9b6d45abb6d5013e0e (patch)
tree58dcae71a522bdc9ea13b4d996257bd2a667aecc /guix
parent53af5605438aa2dbf84cd3539d5524a02a4675da (diff)
import: crate: Allow updating to a specific version.
* guix/import/crate.scm (latest-release): Rename to 'import-release', add #:version argument. If version is given, return an upstream-source for this version.
Diffstat (limited to 'guix')
-rw-r--r--guix/import/crate.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 51bfcd7bed..339dbcd74c 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -354,11 +355,12 @@ look up the development dependencs for the given crate."
(define crate-package?
(url-predicate crate-url?))
-(define (latest-release package)
- "Return an <upstream-source> for the latest release of PACKAGE."
+(define* (import-release package #:key (version #f))
+ "Return an <upstream-source> for the latest release of PACKAGE. Optionally
+include a VERSION string to fetch a specific version."
(let* ((crate-name (guix-package->crate-name package))
(crate (lookup-crate crate-name))
- (version (crate-latest-version crate))
+ (version (or version (crate-latest-version crate)))
(url (crate-uri crate-name version)))
(upstream-source
(package (package-name package))
@@ -370,5 +372,5 @@ look up the development dependencs for the given crate."
(name 'crate)
(description "Updater for crates.io packages")
(pred crate-package?)
- (import latest-release)))
+ (import import-release)))