commit: 3ed86fd971ba3f10751235f95921ebc7e01c2a3f
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 6 15:22:20 2017 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep 6 15:22:20 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ed86fd9
eapi7-ver.eclass: Avoid regexps in _version_parse_range
eclass/eapi7-ver.eclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index fcbf012f0c4..fe85dfff031 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -28,10 +28,10 @@ case ${EAPI:-0} in
esac
_version_parse_range() {
- [[ $1 =~ ^([0-9]+)(-([0-9]*))?$ ]] || die
- start=${BASH_REMATCH[1]}
- [[ ${BASH_REMATCH[2]} ]] && end=${BASH_REMATCH[3]} || end=${start}
- [[ ${start} -ge 0 ]] && [[ -z ${end} || ${start} -le ${end} ]] || die
+ [[ ${1} == [0-9]* ]] || die
+ start=${1%-*}
+ [[ ${1} == *-* ]] && end=${1#*-} || end=${start}
+ [[ ${start} -ge 0 && ( -z ${end} || ${start} -le ${end} ) ]] || die
}
# RETURNS: