[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#57460] [PATCH 08/20] refresh: Allow updating to a specific version
From: |
Hartmut Goebel |
Subject: |
[bug#57460] [PATCH 08/20] refresh: Allow updating to a specific version (git) |
Date: |
Sun, 28 Aug 2022 15:18:34 +0200 |
* guix/import/git.scm
(latest-tag): Add keyword-argument 'version'. If version is given, try to
find the respective version tag.
(latest-git-tag-version): Add keyword-argument 'version' and pass it on to
called functions.
(latest-releease) Rename to (import-release), add keyword-argument 'version'
and pass it on to called functions.
---
guix/import/git.scm | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/guix/import/git.scm b/guix/import/git.scm
index bb5ba4d97e..fdac51edfd 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -146,7 +147,8 @@ version corresponding to the tag, and the cdr is the name
of the tag."
tags)
entry<?))
-(define* (latest-tag url #:key prefix suffix delim pre-releases?)
+(define* (latest-tag url
+ #:key prefix suffix delim pre-releases? (version #f))
"Return the latest version and corresponding tag available from the Git
repository at URL."
(define (pre-release? tag)
@@ -169,11 +171,18 @@ repository at URL."
((null? versions->tags)
(git-no-valid-tags-error))
(else
- (match (last versions->tags)
- ((version . tag)
- (values version tag)))))))
-
-(define (latest-git-tag-version package)
+ (let ((version-to-pick
+ (if version
+ (filter (lambda (vt) (string=? version (car vt)))
+ versions->tags)
+ versions->tags)))
+ (if (null? version-to-pick)
+ (values #f #f)
+ (match (last version-to-pick)
+ ((version . tag)
+ (values version tag)))))))))
+
+(define* (latest-git-tag-version package #:key (version #f))
"Given a PACKAGE, return the latest version of it and the corresponding git
tag, or #false and #false if the latest version could not be determined."
(guard (c ((or (git-no-tags-error? c) (git-no-valid-tags-error? c))
@@ -193,6 +202,7 @@ tag, or #false and #false if the latest version could not
be determined."
(url (git-reference-url (origin-uri source)))
(property (cute assq-ref (package-properties package) <>)))
(latest-tag url
+ #:version version
#:prefix (property 'release-tag-prefix)
#:suffix (property 'release-tag-suffix)
#:delim (property 'release-tag-version-delimiter)
@@ -206,12 +216,13 @@ tag, or #false and #false if the latest version could not
be determined."
(git-reference? (origin-uri origin))))
(_ #f)))
-(define (latest-git-release package)
+(define* (import-git-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE."
(let* ((name (package-name package))
(old-version (package-version package))
(old-reference (origin-uri (package-source package)))
- (new-version new-version-tag (latest-git-tag-version package)))
+ (new-version new-version-tag
+ (latest-git-tag-version package #:version version)))
(and new-version new-version-tag
(upstream-source
(package name)
@@ -226,4 +237,4 @@ tag, or #false and #false if the latest version could not
be determined."
(name 'generic-git)
(description "Updater for packages hosted on Git repositories")
(pred git-package?)
- (import latest-git-release)))
+ (import import-git-release)))
--
2.30.4
- [bug#57460] [PATCH 05/20] refresh: Allow updating to a specific version (gnu-maintenance), (continued)
- [bug#57460] [PATCH 05/20] refresh: Allow updating to a specific version (gnu-maintenance), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 06/20] refresh: Allow updating to a specific version (crate), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 07/20] refresh: Allow updating to a specific version (egg), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 10/20] refresh: Allow updating to a specific version (gnome), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 11/20] refresh: Allow updating to a specific version (hexpm), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 12/20] refresh: Allow updating to a specific version (kde), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 14/20] refresh: Allow updating to a specific version (pypi), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 15/20] refresh: Allow updating to a specific version (script), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 09/20] refresh: Allow updating to a specific version (github), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 08/20] refresh: Allow updating to a specific version (git),
Hartmut Goebel <=
- [bug#57460] [PATCH 13/20] refresh: Allow updating to a specific version (launchpad), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 16/20] refresh: Allow updating to a specific version (upstream), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 17/20] refresh: Allow updating to a specific version (documentation), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 18/20] TEMP REMOVE import: git: Restrict to non-github origins., Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 19/20] TEMP REMOVE upstream: Output names of importers tried., Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 20/20] TEMP REMOVE Add test-script for refesh-with-version, Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 00/19] Refresh to specific version, Maxime Devos, 2022/08/28