summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author宋文武 <iyzsong@member.fsf.org>2025-01-07 14:16:28 +0800
committer宋文武 <iyzsong@member.fsf.org>2025-01-12 14:18:03 +0800
commite74040b73cd38467e886ed9e2f1e1b351d13c2f2 (patch)
tree7a5f3885b290117802ec40c3d993d861d18596a7
parent11d0bdad961bb4924ee415607053b02c45817ab8 (diff)
import: git: Do not search pre-release words in tag prefix.
This fixes tags like 'xfce4-dev-tools-4.20.0'. * tests/import-git.scm ("latest-git-tag-version: prefix contains pre-release words"): New test. * guix/import/git.scm (latest-tag): Don't filter out pre-releases tags. (version-mapping): Filter out pre-releases tags from versions. * gnu/packages/xfce.scm (garcon, thunar-archive-plugin, xfce4-dev-tools): Remove FIXME comments for the 'generic-git' updater. Change-Id: I7683200fa451d7fad153aa08fa9d5761688de01d
-rw-r--r--gnu/packages/xfce.scm3
-rw-r--r--guix/import/git.scm17
-rw-r--r--tests/import-git.scm9
3 files changed, 18 insertions, 11 deletions
diff --git a/gnu/packages/xfce.scm b/gnu/packages/xfce.scm
index 2b22b2ce1ee..c2f4392f761 100644
--- a/gnu/packages/xfce.scm
+++ b/gnu/packages/xfce.scm
@@ -374,7 +374,6 @@ GLib and GIO. It was started as a complete rewrite of the former Xfce menu
374library called libxfce4menu, which, in contrast to garcon, was lacking menu 374library called libxfce4menu, which, in contrast to garcon, was lacking menu
375merging features essential for loading menus modified with menu editors.") 375merging features essential for loading menus modified with menu editors.")
376 (license lgpl2.0+) 376 (license lgpl2.0+)
377 ;; FIXME: the 'generic-git' updater treat "rc" as pre-releases.
378 (properties `((release-tag-prefix . ,(string-append name "-")))))) 377 (properties `((release-tag-prefix . ,(string-append name "-"))))))
379 378
380(define-public tumbler 379(define-public tumbler
@@ -915,7 +914,6 @@ and import the new pictures from your camera.")
915 (description "The Thunar Archive Plugin allows you to create and extract 914 (description "The Thunar Archive Plugin allows you to create and extract
916archive files using the file context menus in the Thunar file manager.") 915archive files using the file context menus in the Thunar file manager.")
917 (license gpl2+) 916 (license gpl2+)
918 ;; FIXME: the 'generic-git' updater treat "rc" as pre-releases.
919 (properties `((release-tag-prefix . ,(string-append name "-")))))) 917 (properties `((release-tag-prefix . ,(string-append name "-"))))))
920 918
921(define-public thunar-shares-plugin 919(define-public thunar-shares-plugin
@@ -2438,5 +2436,4 @@ local weather in the panel, using forecast data provided by the
2438developers and people that want to build Xfce from Git In addition it contains 2436developers and people that want to build Xfce from Git In addition it contains
2439the Xfce developer's handbook.") 2437the Xfce developer's handbook.")
2440 (license gpl2+) 2438 (license gpl2+)
2441 ;; FIXME: the 'generic-git' updater treat "dev" as pre-releases.
2442 (properties `((release-tag-prefix . ,(string-append name "-")))))) 2439 (properties `((release-tag-prefix . ,(string-append name "-"))))))
diff --git a/guix/import/git.scm b/guix/import/git.scm
index ab51719255d..305b2fc43f3 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -138,9 +138,16 @@ version corresponding to the tag, and the cdr is the name of the tag."
138 (define (entry<? a b) 138 (define (entry<? a b)
139 (eq? (version-compare (car a) (car b)) '<)) 139 (eq? (version-compare (car a) (car b)) '<))
140 140
141 (define (pre-release? tag)
142 (any (cut regexp-exec <> tag)
143 %pre-release-rx))
144
141 (stable-sort (filter-map (lambda (tag) 145 (stable-sort (filter-map (lambda (tag)
142 (let ((version (get-version tag))) 146 (let ((version (get-version tag)))
143 (and version (cons version tag)))) 147 (and version
148 (or pre-releases?
149 (not (pre-release? version)))
150 (cons version tag))))
144 tags) 151 tags)
145 entry<?)) 152 entry<?))
146 153
@@ -149,16 +156,10 @@ version corresponding to the tag, and the cdr is the name of the tag."
149 "Return the latest version and corresponding tag available from the Git 156 "Return the latest version and corresponding tag available from the Git
150repository at URL. Optionally include a VERSION string to fetch a specific 157repository at URL. Optionally include a VERSION string to fetch a specific
151version." 158version."
152 (define (pre-release? tag)
153 (any (cut regexp-exec <> tag)
154 %pre-release-rx))
155
156 (let* ((tags (map (cut string-drop <> (string-length "refs/tags/")) 159 (let* ((tags (map (cut string-drop <> (string-length "refs/tags/"))
157 (remote-refs url #:tags? #t))) 160 (remote-refs url #:tags? #t)))
158 (versions->tags 161 (versions->tags
159 (version-mapping (if pre-releases? 162 (version-mapping tags
160 tags
161 (filter (negate pre-release?) tags))
162 #:prefix prefix 163 #:prefix prefix
163 #:suffix suffix 164 #:suffix suffix
164 #:delim delim 165 #:delim delim
diff --git a/tests/import-git.scm b/tests/import-git.scm
index 20255dedb36..6dd8ad1649e 100644
--- a/tests/import-git.scm
+++ b/tests/import-git.scm
@@ -224,4 +224,13 @@
224 (let ((package (make-package directory "1.0.0"))) 224 (let ((package (make-package directory "1.0.0")))
225 (latest-git-tag-version package)))) 225 (latest-git-tag-version package))))
226 226
227(test-equal "latest-git-tag-version: prefix contains pre-release words"
228 "1.0.1"
229 (with-temporary-git-repository directory
230 '((add "a.txt" "A")
231 (commit "First commit")
232 (tag "libdevx-1.0.1" "Release 1.0.1"))
233 (let ((package (make-package directory "1.0.0")))
234 (latest-git-tag-version package))))
235
227(test-end "git") 236(test-end "git")