Subject: [PATCH 06/20] refresh: Allow updating to a specific version (crate)

From: Hartmut Goebel <[email-masked]>
Date: Sun, 28 Aug 2022 15:18:32 +0200

* guix/import/crate.scm(latest-release): Rename to (import-release),
  add keyword-argument 'version'.
  If version is given, return an upstream-source for this version.
---
 guix/import/crate.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 51bfcd7bed..339eccd687 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2019, 2020 Martin Becze <[email-masked]>
 ;;; Copyright © 2021 Nicolas Goaziou <[email-masked]>
+;;; Copyright © 2022 Hartmut Goebel <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -354,11 +355,11 @@ look up the development dependencs for the given crate."
 (define crate-package?
   (url-predicate crate-url?))
 
-(define (latest-release package)
+(define* (import-release package #:key (version #f))
   "Return an <upstream-source> for the latest release of PACKAGE."
   (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 +371,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)))
 
-- 
2.30.4