diff mbox series

[bug#57460,13/20] refresh: Allow updating to a specific version (launchpad)

Message ID d607893f675549746491064b1b62f0ec4ad49e93.1661691694.git.h.goebel@crazy-compilers.com
State New
Headers show
Series Refresh to specific version | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Hartmut Goebel Aug. 28, 2022, 1:18 p.m. UTC
* guix/import/launchpad.scm(latest-release): Rename to (import-release),
  add keyword-argument 'version'.
  If version is given, return an upstream-source for this version.
---
 guix/import/launchpad.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index b7e0295c4e..2112eefe1d 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -2,6 +2,7 @@ 
 ;;; Copyright © 2019, 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -121,7 +122,7 @@  for example, 'linuxdcpp'. Return #f if there is no releases."
       (last (remove pre-release? (vector->list (assoc-ref json "entries"))))
       "version"))))
 
-(define (latest-release pkg)
+(define* (import-release pkg #:key (version #f))
   "Return an <upstream-source> for the latest release of PKG."
   (define (origin-launchpad-uri origin)
     (match (origin-uri origin)
@@ -132,7 +133,7 @@  for example, 'linuxdcpp'. Return #f if there is no releases."
   (let* ((source-uri (origin-launchpad-uri (package-source pkg)))
          (name (package-name pkg))
          (repository (launchpad-repository source-uri))
-         (newest-version (latest-released-version repository)))
+         (newest-version (or version (latest-released-version repository))))
     (if newest-version
         (upstream-source
          (package name)
@@ -145,4 +146,4 @@  for example, 'linuxdcpp'. Return #f if there is no releases."
    (name 'launchpad)
    (description "Updater for Launchpad packages")
    (pred launchpad-package?)
-   (import latest-release)))
+   (import import-release)))