[jhalfs] 03/03: Fix sorting of versions when ending with -rc<n>

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Fri, 21 Mar 2025 17:26:09 +0000
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

commit 4129cc227999275e078a8a7bf7d40eff3107efca
Author: Pierre Labastie <[email protected]>
AuthorDate: Fri Mar 21 18:22:05 2025 +0100

    Fix sorting of versions when ending with -rc<n>
    
    See https://wiki.linuxfromscratch.org/alfs/ticket/1748 for
    details. Add a sed before comparing versions, that change
    anything ending with rc<digit> (in upper or lowercase) to
    ~rc, so that sort -V finds the right order.
    
    Fixes #1748
---
 BLFS/gen_pkg_book.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh
index e4dc8bb..f4b4505 100755
--- a/BLFS/gen_pkg_book.sh
+++ b/BLFS/gen_pkg_book.sh
@@ -234,6 +234,10 @@ $inst_v"
     else
         versions=$(xsltproc --stringparam package "$p" $GetVersion $PackFile)
     fi
+# "sort -V" fails to consider that 1.2.3-rc2 is lower than 1.2.3, for
+# example (or 1.2.3rc2 respective to 1.2.3).
+# Only "~" is lower than anything...
+versions=$(echo "$versions" | sed -E 's/[~-_]?([rR][cC][[:digit:]]*)$/~\1/')
     if [ "$versions" != "$(sort -V <<<$versions)" ]; then
         LIST="$LIST $p"
     fi

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page