commit:     d98555dd2f50fee9140f210a1f8eebd09c0b300e
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  9 08:13:13 2025 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 19:00:37 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d98555dd

version-functions.sh: Renamed from eapi7-ver-funcs.sh

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 bin/install-qa-check.d/60pkgconfig                 |  2 +-
 bin/isolated-functions.sh                          |  2 +-
 bin/save-ebuild-env.sh                             | 17 +++++++-------
 bin/{eapi7-ver-funcs.sh => version-functions.sh}   | 26 +++++++++++-----------
 lib/portage/tests/bin/meson.build                  |  2 +-
 .../{test_eapi7_ver_funcs.py => test_ver_funcs.py} |  8 +++----
 6 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/bin/install-qa-check.d/60pkgconfig 
b/bin/install-qa-check.d/60pkgconfig
index 10484dce92..27df0fb877 100644
--- a/bin/install-qa-check.d/60pkgconfig
+++ b/bin/install-qa-check.d/60pkgconfig
@@ -4,7 +4,7 @@
 
 # Ensure that ver_test is available.
 if ! ___eapi_has_version_functions; then
-       source "${PORTAGE_BIN_PATH:?}/eapi7-ver-funcs.sh" || exit
+       source "${PORTAGE_BIN_PATH:?}/version-functions.sh" || exit
 fi
 
 pkgconfig_check() {

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 0fd9c8bd99..fdca233323 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -6,7 +6,7 @@
 source "${PORTAGE_BIN_PATH:?}/eapi.sh" || exit
 
 if ___eapi_has_version_functions; then
-       source "${PORTAGE_BIN_PATH}/eapi7-ver-funcs.sh" || exit 1
+       source "${PORTAGE_BIN_PATH}/version-functions.sh" || exit 1
 fi
 
 if [[ -v PORTAGE_EBUILD_EXTRA_SOURCE ]]; then

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 242b58b70f..01bdcdd994 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -91,17 +91,16 @@ __save_ebuild_env() (
                __check_bash_version __compose_bzip2_cmd __dyn_configure
                __dyn_compile __dyn_install __dyn_prepare __dyn_pretend
                __dump_trace __dyn_unpack __dyn_clean __dyn_setup __dyn_help
-               __dyn_test __ebuild_phase_with_hooks __eapi7_ver_compare_int
-               __eapi7_ver_parse_range __ebuild_arg_to_phase
-               __ebuild_phase_funcs __eapi7_ver_compare __eapi7_ver_split
-               __ebuild_phase __ebuild_main __elog_base __eqaquote __eqatag
-               __eend __filter_readonly_variables __has_phase_defined_up_to
-               __helpers_die __hasgq __hasg __preprocess_ebuild_env
-               __quiet_mode __qa_source __qa_call __repo_attr
-               __strip_duplicate_slashes __source_all_bashrcs
+               __dyn_test __ebuild_phase_with_hooks __ebuild_arg_to_phase
+               __ebuild_phase_funcs __ebuild_phase __ebuild_main __elog_base
+               __eqaquote __eqatag __eend __filter_readonly_variables
+               __has_phase_defined_up_to __helpers_die __hasgq __hasg
+               __preprocess_ebuild_env __quiet_mode __qa_source __qa_call
+               __repo_attr __strip_duplicate_slashes __source_all_bashrcs
                __source_env_files __save_ebuild_env __sb_append_var
                __start_distcc __set_colors __try_source __unset_colors
-               __unpack_tar __vecho
+               __unpack_tar __vecho __ver_compare __ver_compare_int
+               __ver_parse_range __ver_split
 
                addpredict addwrite adddeny addread assert best_version
                contains_word configparser debug-print-function

diff --git a/bin/eapi7-ver-funcs.sh b/bin/version-functions.sh
similarity index 88%
rename from bin/eapi7-ver-funcs.sh
rename to bin/version-functions.sh
index 45a8285b70..f07b03192c 100644
--- a/bin/eapi7-ver-funcs.sh
+++ b/bin/version-functions.sh
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # shellcheck disable=SC2128
 
-__eapi7_ver_parse_range() {
+__ver_parse_range() {
        local range=${1}
        local max=${2}
 
@@ -20,7 +20,7 @@ __eapi7_ver_parse_range() {
        fi
 }
 
-__eapi7_ver_split() {
+__ver_split() {
        local v=${1} LC_ALL=C
 
        comp=()
@@ -45,9 +45,9 @@ ver_cut() {
        local start end
        local -a comp
 
-       __eapi7_ver_split "${v}"
+       __ver_split "${v}"
        local max=$((${#comp[@]}/2))
-       __eapi7_ver_parse_range "${range}" "${max}"
+       __ver_parse_range "${range}" "${max}"
 
        local IFS=
        if [[ ${start} -gt 0 ]]; then
@@ -62,11 +62,11 @@ ver_rs() {
        local start end i
        local -a comp
 
-       __eapi7_ver_split "${v}"
+       __ver_split "${v}"
        local max=$((${#comp[@]}/2 - 1))
 
        while [[ ${#} -ge 2 ]]; do
-               __eapi7_ver_parse_range "${1}" "${max}"
+               __ver_parse_range "${1}" "${max}"
                for (( i = start*2; i <= end*2; i+=2 )); do
                        [[ ${i} -eq 0 && -z ${comp[i]} ]] && continue
                        comp[i]=${2}
@@ -78,7 +78,7 @@ ver_rs() {
        echo "${comp[*]}"
 }
 
-__eapi7_ver_compare_int() {
+__ver_compare_int() {
        local a=$1 b=$2 d=$(( ${#1}-${#2} ))
 
        # Zero-pad to equal length if necessary.
@@ -92,7 +92,7 @@ __eapi7_ver_compare_int() {
        [[ ${a} == "${b}" ]]
 }
 
-__eapi7_ver_compare() {
+__ver_compare() {
        local va=${1} vb=${2} a an al as ar b bn bl bs br re LC_ALL=C
 
        
re="^([0-9]+(\.[0-9]+)*)([a-z]?)((_(alpha|beta|pre|rc|p)[0-9]*)*)(-r[0-9]+)?$"
@@ -111,7 +111,7 @@ __eapi7_ver_compare() {
 
        # Compare numeric components (PMS algorithm 3.2)
        # First component
-       __eapi7_ver_compare_int "${an%%.*}" "${bn%%.*}" || return
+       __ver_compare_int "${an%%.*}" "${bn%%.*}" || return
 
        while [[ ${an} == *.* && ${bn} == *.* ]]; do
                # Other components (PMS algorithm 3.3)
@@ -126,7 +126,7 @@ __eapi7_ver_compare() {
                        [[ ${a} > ${b} ]] && return 3
                        [[ ${a} < ${b} ]] && return 1
                else
-                       __eapi7_ver_compare_int "${a}" "${b}" || return
+                       __ver_compare_int "${a}" "${b}" || return
                fi
        done
        [[ ${an} == *.* ]] && return 3
@@ -144,7 +144,7 @@ __eapi7_ver_compare() {
                a=${as%%_*}
                b=${bs%%_*}
                if [[ ${a%%[0-9]*} == "${b%%[0-9]*}" ]]; then
-                       __eapi7_ver_compare_int "${a##*[a-z]}" "${b##*[a-z]}" 
|| return
+                       __ver_compare_int "${a##*[a-z]}" "${b##*[a-z]}" || 
return
                else
                        # Check for p first
                        [[ ${a%%[0-9]*} == p ]] && return 3
@@ -162,7 +162,7 @@ __eapi7_ver_compare() {
        fi
 
        # Compare revision components (PMS algorithm 3.7)
-       __eapi7_ver_compare_int "${ar#-r}" "${br#-r}" || return
+       __ver_compare_int "${ar#-r}" "${br#-r}" || return
 
        return 2
 }
@@ -187,6 +187,6 @@ ver_test() {
                *) die "${FUNCNAME}: invalid operator: ${op}" ;;
        esac
 
-       __eapi7_ver_compare "${va}" "${vb}"
+       __ver_compare "${va}" "${vb}"
        test $? "${op}" 2
 }

diff --git a/lib/portage/tests/bin/meson.build 
b/lib/portage/tests/bin/meson.build
index 519972f0a8..182b7bf208 100644
--- a/lib/portage/tests/bin/meson.build
+++ b/lib/portage/tests/bin/meson.build
@@ -4,7 +4,7 @@ py.install_sources(
         'test_dobin.py',
         'test_dodir.py',
         'test_doins.py',
-        'test_eapi7_ver_funcs.py',
+        'test_ver_funcs.py',
         'test_filter_bash_env.py',
         '__init__.py',
         '__test__.py',

diff --git a/lib/portage/tests/bin/test_eapi7_ver_funcs.py 
b/lib/portage/tests/bin/test_ver_funcs.py
similarity index 97%
rename from lib/portage/tests/bin/test_eapi7_ver_funcs.py
rename to lib/portage/tests/bin/test_ver_funcs.py
index 0483a35b3e..ff465fb3cf 100644
--- a/lib/portage/tests/bin/test_eapi7_ver_funcs.py
+++ b/lib/portage/tests/bin/test_ver_funcs.py
@@ -1,4 +1,4 @@
-# Copyright 2018 Gentoo Foundation
+# Copyright 2018-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import subprocess
@@ -14,7 +14,7 @@ class TestEAPI7VerFuncs(TestCase):
         Test that commands in test_cases produce expected output.
         """
         with tempfile.NamedTemporaryFile("w") as test_script:
-            test_script.write(f'source 
"{PORTAGE_BIN_PATH}"/eapi7-ver-funcs.sh\n')
+            test_script.write(f'source 
"{PORTAGE_BIN_PATH}"/version-functions.sh\n')
             for cmd, exp in test_cases:
                 test_script.write(f"{cmd}\n")
             test_script.flush()
@@ -36,7 +36,7 @@ class TestEAPI7VerFuncs(TestCase):
         Test that commands in test_cases give appropriate exit codes.
         """
         with tempfile.NamedTemporaryFile("w+") as test_script:
-            test_script.write(f'source 
"{PORTAGE_BIN_PATH}"/eapi7-ver-funcs.sh\n')
+            test_script.write(f'source 
"{PORTAGE_BIN_PATH}"/version-functions.sh\n')
             for cmd, exp in test_cases:
                 test_script.write(f"{cmd}; echo $?\n")
             test_script.flush()
@@ -60,7 +60,7 @@ class TestEAPI7VerFuncs(TestCase):
 
         for cmd in test_cases:
             test = f"""
-source "{PORTAGE_BIN_PATH}"/eapi7-ver-funcs.sh
+source "{PORTAGE_BIN_PATH}"/version-functions.sh
 die() {{ exit 1; }}
 {cmd}"""
 

Reply via email to