From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:eapi7-ver commit in: eclass/
Date: Wed, 6 Sep 2017 15:31:42 +0000 (UTC) [thread overview]
Message-ID: <1504711897.1e68066e762b533245eeda9e1f900499bb4620c2.mgorny@gentoo> (raw)
commit: 1e68066e762b533245eeda9e1f900499bb4620c2
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 6 15:31:37 2017 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep 6 15:31:37 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e68066e
eapi7-ver.eclass: Avoid regexps in _version_split
eclass/eapi7-ver.eclass | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index fe85dfff031..d71a2427dd7 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -43,10 +43,16 @@ _version_split() {
comp=()
# get separators and components
+ local s c
while [[ ${v} ]]; do
- [[ ${v} =~ ^([^A-Za-z0-9]*)([A-Za-z]*|[0-9]*) ]] || die
- comp+=("${BASH_REMATCH[@]:1:2}")
- v=${v:${#BASH_REMATCH[0]}}
+ # cut the separator
+ s="${v%%[a-zA-Z0-9]*}"
+ v=${v:${#s}}
+ # cut the next component; it can be either digits or letters
+ [[ ${v} == [0-9]* ]] && c=${v%%[^0-9]*} || c=${v%%[^a-zA-Z]*}
+ v=${v:${#c}}
+
+ comp+=( "${s}" "${c}" )
done
}
next reply other threads:[~2017-09-06 15:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 15:31 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-09-23 5:46 [gentoo-commits] repo/gentoo:eapi7-ver commit in: eclass/ Ulrich Müller
2017-09-22 21:28 Ulrich Müller
2017-09-22 16:10 Ulrich Müller
2017-09-21 14:04 Michał Górny
2017-09-21 14:04 Michał Górny
2017-09-21 13:26 Ulrich Müller
2017-09-21 12:57 Ulrich Müller
2017-09-21 7:38 Ulrich Müller
2017-09-21 7:04 Michał Górny
2017-09-20 21:19 Ulrich Müller
2017-09-12 16:37 Ulrich Müller
2017-09-12 16:37 Ulrich Müller
2017-09-08 11:11 Michał Górny
2017-09-08 11:11 Michał Górny
2017-09-06 15:22 Michał Górny
2017-09-06 13:45 Michał Górny
2017-09-06 13:45 Michał Górny
2017-09-06 13:40 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504711897.1e68066e762b533245eeda9e1f900499bb4620c2.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox