From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 06E2E1396D0 for ; Wed, 6 Sep 2017 13:45:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 62B51E0C5F; Wed, 6 Sep 2017 13:45:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3F354E0C5F for ; Wed, 6 Sep 2017 13:45:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4B8A8340988 for ; Wed, 6 Sep 2017 13:45:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 02A0B8B8F for ; Wed, 6 Sep 2017 13:45:28 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1504705486.0027cf6d4b6110dbaf5876ee0e891342fae3c984.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:eapi7-ver commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/eapi7-ver.eclass X-VCS-Directories: eclass/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 0027cf6d4b6110dbaf5876ee0e891342fae3c984 X-VCS-Branch: eapi7-ver Date: Wed, 6 Sep 2017 13:45:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 576e5911-f9c9-4ece-bfcd-591d7b45f7e1 X-Archives-Hash: a714e63a3a99d2610067d45243db9f57 commit: 0027cf6d4b6110dbaf5876ee0e891342fae3c984 Author: Michał Górny gentoo org> AuthorDate: Wed Sep 6 13:44:17 2017 +0000 Commit: Michał Górny gentoo org> CommitDate: Wed Sep 6 13:44:46 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0027cf6d eapi7-ver.eclass: Use the power of maths to simplify splitting eclass/eapi7-ver.eclass | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass index 70a1b3e9847..27571bc0d03 100644 --- a/eclass/eapi7-ver.eclass +++ b/eclass/eapi7-ver.eclass @@ -51,7 +51,7 @@ _version_split() { } version_cut() { - local start end istart iend + local start end istart local -a comp _version_parse_range "$1" @@ -59,14 +59,12 @@ version_cut() { local IFS= if [[ ${start} -gt 0 ]]; then - istart=$(( (start-1)*2 + 1 )) - iend=$(( (end-start)*2 + 1 )) + istart=$(( start*2 - 1 )) else istart=0 - iend=$(( (end-start)*2 )) fi if [[ ${end} ]]; then - echo "${comp[*]:istart:iend}" + echo "${comp[*]:istart:end*2-istart}" else echo "${comp[*]:istart}" fi