[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
21/23: generic-git
From: |
guix-commits |
Subject: |
21/23: generic-git |
Date: |
Mon, 4 Jul 2022 09:49:27 -0400 (EDT) |
htgoebel pushed a commit to branch wip-import-version
in repository guix.
commit eb5de11e37d45fe21702e623dc26a7946fd0047d
Author: Hartmut Goebel <h.goebel@crazy-compilers.com>
AuthorDate: Thu Jun 30 11:05:13 2022 +0200
generic-git
* guix/import/git.scm(latest-tag): Add kw-arg version and handle it.
(latest-git-tag-version, latest-git-release): Add kw-arg version and pass
it
on to called functions.
---
guix/import/git.scm | 26 ++++++++++++++++++--------
guix/scripts/refresh.scm | 1 +
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/guix/import/git.scm b/guix/import/git.scm
index e4d35ed87f..cea58ab02d 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -148,7 +148,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)
@@ -171,11 +172,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))
@@ -195,6 +203,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)
@@ -209,12 +218,13 @@ tag, or #false and #false if the latest version could not
be determined."
(not (github-package? package))))
(_ #f)))
-(define (latest-git-release package)
+(define* (latest-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)
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 14329751f8..ae8fb97b36 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
- 07/23: import: git: Restrict to non-github origins., (continued)
- 07/23: import: git: Restrict to non-github origins., guix-commits, 2022/07/04
- 09/23: updaters: issue error-message if version is given:, guix-commits, 2022/07/04
- 11/23: sourceforge: not supported, too complicate to implement., guix-commits, 2022/07/04
- 10/23: cran/bioconductor, guix-commits, 2022/07/04
- 12/23: gnu-maintenance (kernel.org, ftp, html, savannah, xorg, gnu), guix-commits, 2022/07/04
- 13/23: pypi:, guix-commits, 2022/07/04
- 15/23: egg, guix-commits, 2022/07/04
- 16/23: hexpm, guix-commits, 2022/07/04
- 14/23: crate, guix-commits, 2022/07/04
- 19/23: kde:, guix-commits, 2022/07/04
- 21/23: generic-git,
guix-commits <=
- 23/23: upstream.scm, guix-commits, 2022/07/04
- 17/23: launchpad, guix-commits, 2022/07/04
- 18/23: gnome:, guix-commits, 2022/07/04
- 20/23: github REWORD, guix-commits, 2022/07/04
- 22/23: refresh, guix-commits, 2022/07/04