From 3986caacae773c7f2f69a013b44d3d64dffe9f50 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Wed, 29 Jun 2022 10:15:47 +0200 Subject: [PATCH] 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. --- guix/import/launchpad.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm index b7e0295c4e..01953ea69c 100644 --- a/guix/import/launchpad.scm +++ b/guix/import/launchpad.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2019, 2020 Arun Isaac ;;; Copyright © 2021 Matthew James Kraai ;;; Copyright © 2020 Brice Waegeneire +;;; Copyright © 2022 Hartmut Goebel ;;; ;;; 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")))) "version")))) -(define (latest-release pkg) - "Return an for the latest release of PKG." +(define* (import-release pkg #:key (version #f)) + "Return an for the latest release of PKG. Optionally +include a VERSION string to fetch a specific version." (define (origin-launchpad-uri origin) (match (origin-uri origin) ((? 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))) (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 +147,4 @@ (define %launchpad-updater (name 'launchpad) (description "Updater for Launchpad packages") (pred launchpad-package?) - (import latest-release))) + (import import-release)))