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