summary refs log tree commit diff
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2022-06-29 09:39:51 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2022-12-26 17:38:05 +0100
commite689f970335a67bc0aea611f1502cfeb6f4b6650 (patch)
tree00047b99f0d7eb0bfd4bce1c186df2cfa346153a
parentc7faeae2b1d313a6a04ecb6d3cac2dfd35320e29 (diff)
downloadguix-e689f970335a67bc0aea611f1502cfeb6f4b6650.tar.gz
import: hexpm: Allow updating to a specific version.
* guix/import/hexpm.scm (latest-release): Rename to 'import-release',
  add #:version argument.
  If version is given, return an upstream-source for this version.
-rw-r--r--guix/import/hexpm.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 3b63837393..8a009fd245 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -328,11 +328,12 @@ latest version of PACKAGE-NAME."
 ;;; Updater
 ;;;
 
-(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* ((hexpm-name (guix-package->hexpm-name package))
          (hexpm      (lookup-hexpm hexpm-name))
-         (version    (hexpm-latest-release hexpm))
+         (version    (or version (hexpm-latest-release hexpm)))
          (url        (hexpm-uri hexpm-name version)))
     (upstream-source
      (package (package-name package))
@@ -344,4 +345,4 @@ latest version of PACKAGE-NAME."
    (name 'hexpm)
    (description "Updater for hex.pm packages")
    (pred (url-prefix-predicate hexpm-package-url))
-   (import latest-release)))
+   (import import-release)))