From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 836241384B4 for ; Mon, 7 Dec 2015 07:06:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6E4E121C051; Mon, 7 Dec 2015 07:06:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 711FA21C020 for ; Mon, 7 Dec 2015 07:06:03 +0000 (UTC) Received: from [10.215.50.137] (public-gprs516565.centertel.pl [31.61.137.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 955493405CF; Mon, 7 Dec 2015 07:06:00 +0000 (UTC) User-Agent: K-9 Mail for Android In-Reply-To: <20151207053750.GA23517@meriadoc> References: <22106.6463.805834.391338@a1i15.kph.uni-mainz.de> <20151207053750.GA23517@meriadoc> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [gentoo-dev] RFD: Replacement for versionator.eclass in PMS (for EAPI 7?) From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= Date: Mon, 07 Dec 2015 08:00:32 +0100 To: gentoo-dev@lists.gentoo.org,Jason Zaman Message-ID: X-Archives-Salt: 3226b0c1-db50-497d-b113-46d814d38d18 X-Archives-Hash: f2a968f50c130aff87f38d4396fabfd7 Dnia 7 grudnia 2015 06:37:50 CET, Jason Zaman napisaƂ(a): >On Sat, Nov 28, 2015 at 10:14:39PM +0100, Ulrich Mueller wrote: >> Questions: >> 1. Will these three functions be sufficient, or have we overlooked >> anything important? > >Can we also have get_version_component_count() in there? > >I have a package that likes to change the number of parts so I need to >know how many parts before I can split it up. > >Basically this: >if [[ $(get_version_component_count) -eq 6 ]]; then > STUDIO_V=$(get_version_component_range 1-4) > BUILD_V=$(get_version_component_range 5-6) >else > STUDIO_V=$(get_version_component_range 1-3) > BUILD_V=$(get_version_component_range 4-5) >fi local v=( ${PV//./} ) then ${#v[@]}. With some more work, you should be even able to use negative indexing there to avoid conditionals. I'd rather avoid introducing extra redundant functions for corner cases. > >-- Jason -- Sent from my Android device with K-9 Mail. Please excuse my brevity.