commit:     f6b294ffb09d2b118c3b12f7daa1b79ef53bfc0d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  6 13:33:29 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep  6 13:33:29 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6b294ff

eapi7-ver.eclass: Handle versions with preceding sep

 eclass/eapi7-ver.eclass   | 9 ++-------
 eclass/tests/eapi7-ver.sh | 3 ++-
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index e9f2c453514..e2458deeb7b 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -40,14 +40,9 @@ _version_parse_range() {
 _version_split() {
        local v=$1 LC_ALL=C
 
-       comp=("")
+       comp=()
 
-       # get first component
-       [[ ${v} =~ ^([A-Za-z]*|[0-9]*) ]] || die
-       comp+=("${BASH_REMATCH[1]}")
-       v=${v:${#BASH_REMATCH[0]}}
-
-       # get remaining separators and components
+       # get separators and components
        while [[ ${v} ]]; do
                [[ ${v} =~ ^([^A-Za-z0-9]*)([A-Za-z]*|[0-9]*) ]] || die
                comp+=("${BASH_REMATCH[@]:1:2}")

diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh
index 769886fd6b1..0f3a1f37e86 100755
--- a/eclass/tests/eapi7-ver.sh
+++ b/eclass/tests/eapi7-ver.sh
@@ -29,13 +29,14 @@ teq 2.3 version_cut 2- 1.2.3
 teq 1.2.3 version_cut 1- 1.2.3
 teq 3b version_cut 3-4 1.2.3b_alpha4
 teq alpha version_cut 5 1.2.3b_alpha4
-#teq 1.2 version_cut 1-2 .1.2.3
+teq 1.2 version_cut 1-2 .1.2.3
 #teq .1.2 version_cut 0-2 .1.2.3
 teq 2.3 version_cut 2-3 1.2.3.
 teq 2.3. version_cut 2- 1.2.3.
 
 teq 1.23-b_alpha4 version_rs 3 - 2 "" 1.2.3b_alpha4
 teq a1b_2-c-3-d4e5 version_rs 3-5 _ 4-6 - a1b2c3d4e5
+teq .1-2.3 version_rs 1 - .1.2.3
 
 txf version_cut foo 1.2.3
 #txf version_rs 5-3 _ a1b2c3d4e5

Reply via email to