GNU bug report logs - #75418
[PATCH] import: git: Do not search pre-release words in tag prefix.

Previous Next

Package: guix-patches;

Reported by: iyzsong <at> envs.net

Date: Tue, 7 Jan 2025 06:14:01 UTC

Severity: normal

Tags: patch

Done: 宋文武 <iyzsong <at> envs.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75418 in the body.
You can then email your comments to 75418 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to iyzsong <at> envs.net, guix-patches <at> gnu.org:
bug#75418; Package guix-patches. (Tue, 07 Jan 2025 06:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to iyzsong <at> envs.net:
New bug report received and forwarded. Copy sent to iyzsong <at> envs.net, guix-patches <at> gnu.org. (Tue, 07 Jan 2025 06:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: iyzsong <at> envs.net
To: guix-patches <at> gnu.org
Cc: 宋文武 <iyzsong <at> member.fsf.org>
Subject: [PATCH] import: git: Do not search pre-release words in tag prefix.
Date: Tue,  7 Jan 2025 14:16:28 +0800
From: 宋文武 <iyzsong <at> member.fsf.org>

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
---
 gnu/packages/xfce.scm |  3 ---
 guix/import/git.scm   | 17 +++++++++--------
 tests/import-git.scm  |  9 +++++++++
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/xfce.scm b/gnu/packages/xfce.scm
index c5e5009ccf..95520b9c22 100644
--- a/gnu/packages/xfce.scm
+++ b/gnu/packages/xfce.scm
@@ -374,7 +374,6 @@ (define-public garcon
 library called libxfce4menu, which, in contrast to garcon, was lacking menu
 merging features essential for loading menus modified with menu editors.")
     (license lgpl2.0+)
-    ;; FIXME: the 'generic-git' updater treat "rc" as pre-releases.
     (properties `((release-tag-prefix . ,(string-append name "-"))))))
 
 (define-public tumbler
@@ -894,7 +893,6 @@ (define-public thunar-archive-plugin
     (description "The Thunar Archive Plugin allows you to create and extract
 archive files using the file context menus in the Thunar file manager.")
     (license gpl2+)
-    ;; FIXME: the 'generic-git' updater treat "rc" as pre-releases.
     (properties `((release-tag-prefix . ,(string-append name "-"))))))
 
 (define-public thunar-shares-plugin
@@ -2417,5 +2415,4 @@ (define-public xfce4-dev-tools
 developers and people that want to build Xfce from Git In addition it contains
 the Xfce developer's handbook.")
     (license gpl2+)
-    ;; FIXME: the 'generic-git' updater treat "dev" as pre-releases.
     (properties `((release-tag-prefix . ,(string-append name "-"))))))
diff --git a/guix/import/git.scm b/guix/import/git.scm
index ab51719255..305b2fc43f 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -138,9 +138,16 @@ (define* (version-mapping tags #:key prefix suffix delim pre-releases?)
   (define (entry<? a b)
     (eq? (version-compare (car a) (car b)) '<))
 
+  (define (pre-release? tag)
+    (any (cut regexp-exec <> tag)
+         %pre-release-rx))
+
   (stable-sort (filter-map (lambda (tag)
                              (let ((version (get-version tag)))
-                               (and version (cons version tag))))
+                               (and version
+                                    (or pre-releases?
+                                        (not (pre-release? version)))
+                                    (cons version tag))))
                            tags)
                entry<?))
 
@@ -149,16 +156,10 @@ (define* (latest-tag url
   "Return the latest version and corresponding tag available from the Git
 repository at URL. Optionally include a VERSION string to fetch a specific
 version."
-  (define (pre-release? tag)
-    (any (cut regexp-exec <> tag)
-         %pre-release-rx))
-
   (let* ((tags (map (cut string-drop <> (string-length "refs/tags/"))
                     (remote-refs url #:tags? #t)))
          (versions->tags
-          (version-mapping (if pre-releases?
-                               tags
-                               (filter (negate pre-release?) tags))
+          (version-mapping tags
                            #:prefix prefix
                            #:suffix suffix
                            #:delim delim
diff --git a/tests/import-git.scm b/tests/import-git.scm
index 20255dedb3..6dd8ad1649 100644
--- a/tests/import-git.scm
+++ b/tests/import-git.scm
@@ -224,4 +224,13 @@ (define* (make-package directory version #:optional (properties '()))
     (let ((package (make-package directory "1.0.0")))
       (latest-git-tag-version package))))
 
+(test-equal "latest-git-tag-version: prefix contains pre-release words"
+  "1.0.1"
+  (with-temporary-git-repository directory
+      '((add "a.txt" "A")
+        (commit "First commit")
+        (tag "libdevx-1.0.1" "Release 1.0.1"))
+    (let ((package (make-package directory "1.0.0")))
+      (latest-git-tag-version package))))
+
 (test-end "git")

base-commit: 329daafcc3c798dd180fd98ff757452e3e016235
-- 
2.47.1





Reply sent to 宋文武 <iyzsong <at> envs.net>:
You have taken responsibility. (Sun, 12 Jan 2025 06:18:03 GMT) Full text and rfc822 format available.

Notification sent to iyzsong <at> envs.net:
bug acknowledged by developer. (Sun, 12 Jan 2025 06:18:03 GMT) Full text and rfc822 format available.

Message #10 received at 75418-done <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: 75418-done <at> debbugs.gnu.org
Subject: Re: [bug#75418] [PATCH] import: git: Do not search pre-release
 words in tag prefix.
Date: Sun, 12 Jan 2025 14:21:07 +0800
Pushed to master.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 09 Feb 2025 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 130 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.