commit: 809ea16aecd3abf1d3d59be2de49f07c37d95ffc Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Wed Sep 6 15:14:30 2017 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Wed Sep 6 15:14:30 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=809ea16a
eapi7-ver.eclass: Fix 'M-' rs not to add suffix component eclass/eapi7-ver.eclass | 2 +- eclass/tests/eapi7-ver.sh | 4 ++++ eclass/tests/eapi7-ver:benchmark.sh | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass index 065a27974a9..fcbf012f0c4 100644 --- a/eclass/eapi7-ver.eclass +++ b/eclass/eapi7-ver.eclass @@ -76,7 +76,7 @@ version_rs() { while [[ $# -ge 2 ]]; do _version_parse_range "$1" - [[ ${end} && ${end} -le $((${#comp[@]}/2)) ]] || end=$((${#comp[@]}/2)) + [[ ${end} && ${end} -le $((${#comp[@]}/2)) ]] || end=$((${#comp[@]}/2 - 1)) for (( i = start*2; i <= end*2; i+=2 )); do comp[i]=$2 done diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh index a7fd55e374d..9e678d1379c 100755 --- a/eclass/tests/eapi7-ver.sh +++ b/eclass/tests/eapi7-ver.sh @@ -24,6 +24,7 @@ txf() { tend ${?} "function did not die" } +teq 1 version_cut 1 1.2.3 teq 1.2 version_cut 1-2 1.2.3 teq 2.3 version_cut 2- 1.2.3 teq 1.2.3 version_cut 1- 1.2.3 @@ -35,7 +36,10 @@ teq 2.3 version_cut 2-3 1.2.3. teq 2.3. version_cut 2- 1.2.3. teq 2.3. version_cut 2-4 1.2.3. +teq 1-2.3 version_rs 1 - 1.2.3 teq 1.2-3 version_rs 2 - 1.2.3 +teq 1-2-3.4 version_rs 1-2 - 1.2.3.4 +teq 1.2-3-4 version_rs 2- - 1.2.3.4 teq 1.2.3 version_rs 2 . 1.2-3 teq 1.2.3.a version_rs 3 . 1.2.3a teq 1.2-alpha-4 version_rs 2-3 - 1.2_alpha4 diff --git a/eclass/tests/eapi7-ver:benchmark.sh b/eclass/tests/eapi7-ver:benchmark.sh index 6a1001473b4..9e2cc24a2aa 100755 --- a/eclass/tests/eapi7-ver:benchmark.sh +++ b/eclass/tests/eapi7-ver:benchmark.sh @@ -11,6 +11,7 @@ inherit eapi7-ver cutting() { local x for x in {1..1000}; do + version_cut 1 1.2.3 version_cut 1-2 1.2.3 version_cut 2- 1.2.3 version_cut 1- 1.2.3 @@ -27,7 +28,10 @@ cutting() { replacing() { local x for x in {1..1000}; do + version_rs 1 - 1.2.3 version_rs 2 - 1.2.3 + version_rs 1-2 - 1.2.3.4 + version_rs 2- - 1.2.3.4 version_rs 2 . 1.2-3 version_rs 3 . 1.2.3a version_rs 2-3 - 1.2_alpha4