public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
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 13:40:49 +0000 (UTC)	[thread overview]
Message-ID: <1504704716.f7a0474438f6571cf105fe7aa8bf3831f8bddb09.mgorny@gentoo> (raw)

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

eapi7-ver.eclass: Shift component indexes to account for possible s0

 eclass/eapi7-ver.eclass | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index 2485c45637b..e9f2c453514 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -34,12 +34,17 @@ _version_parse_range() {
 	[[ ${start} -gt 0 ]] && [[ -z ${end} || ${start} -le ${end} ]] || die
 }
 
+# RETURNS:
+# comp=( s0 c1 s1 c2 s2... )
+# where s - separator, c - component
 _version_split() {
 	local v=$1 LC_ALL=C
 
+	comp=("")
+
 	# get first component
 	[[ ${v} =~ ^([A-Za-z]*|[0-9]*) ]] || die
-	comp=("${BASH_REMATCH[1]}")
+	comp+=("${BASH_REMATCH[1]}")
 	v=${v:${#BASH_REMATCH[0]}}
 
 	# get remaining separators and components
@@ -59,9 +64,9 @@ version_cut() {
 
 	local IFS=
 	if [[ ${end} ]]; then
-		echo "${comp[*]:(start-1)*2:(end-start)*2+1}"
+		echo "${comp[*]:(start-1)*2+1:(end-start)*2+1}"
 	else
-		echo "${comp[*]:(start-1)*2}"
+		echo "${comp[*]:(start-1)*2+1}"
 	fi
 }
 
@@ -74,7 +79,7 @@ version_rs() {
 	while [[ $# -ge 2 ]]; do
 		_version_parse_range "$1"
 		[[ ${end} && ${end} -le $((${#comp[@]}/2)) ]] || end=$((${#comp[@]}/2))
-		for (( i = start*2 - 1; i < end*2; i+=2 )); do
+		for (( i = start*2; i <= end*2; i+=2 )); do
 			comp[i]=$2
 		done
 		shift 2


             reply	other threads:[~2017-09-06 13:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06 13:40 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-06 13:45 [gentoo-commits] repo/gentoo:eapi7-ver commit in: eclass/ Michał Górny
2017-09-06 13:45 Michał Górny
2017-09-06 15:22 Michał Górny
2017-09-06 15:31 Michał Górny
2017-09-08 11:11 Michał Górny
2017-09-08 11:11 Michał Górny
2017-09-12 16:37 Ulrich Müller
2017-09-12 16:37 Ulrich Müller
2017-09-20 21:19 Ulrich Müller
2017-09-21  7:04 Michał Górny
2017-09-21  7:38 Ulrich Müller
2017-09-21 12:57 Ulrich Müller
2017-09-21 13:26 Ulrich Müller
2017-09-21 14:04 Michał Górny
2017-09-21 14:04 Michał Górny
2017-09-22 16:10 Ulrich Müller
2017-09-22 21:28 Ulrich Müller
2017-09-23  5:46 Ulrich Müller

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=1504704716.f7a0474438f6571cf105fe7aa8bf3831f8bddb09.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