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 F41BC1384B4 for ; Mon, 7 Dec 2015 07:41:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 47C4B21C058; Mon, 7 Dec 2015 07:41:18 +0000 (UTC) Received: from a1www.kph.uni-mainz.de (a1www.kph.uni-mainz.de [134.93.134.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1DB3D21C044 for ; Mon, 7 Dec 2015 07:41:16 +0000 (UTC) Received: from a1i15.kph.uni-mainz.de (a1i15.kph.uni-mainz.de [134.93.134.92]) by a1www.kph.uni-mainz.de (8.14.9/8.14.7) with ESMTP id tB77fETH027155 for ; Mon, 7 Dec 2015 08:41:14 +0100 Received: from a1i15.kph.uni-mainz.de (localhost [127.0.0.1]) by a1i15.kph.uni-mainz.de (8.14.8/8.14.2) with ESMTP id tB77fEte022720; Mon, 7 Dec 2015 08:41:14 +0100 Received: (from ulm@localhost) by a1i15.kph.uni-mainz.de (8.14.8/8.14.8/Submit) id tB77fDjh022716; Mon, 7 Dec 2015 08:41:13 +0100 Message-ID: <22117.14361.364844.986597@a1i15.kph.uni-mainz.de> Date: Mon, 7 Dec 2015 08:41:13 +0100 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] RFD: Replacement for versionator.eclass in PMS (for EAPI 7?) In-Reply-To: <20151207053750.GA23517@meriadoc> References: <22106.6463.805834.391338@a1i15.kph.uni-mainz.de> <20151207053750.GA23517@meriadoc> X-Mailer: VM 8.2.0b under 24.3.1 (x86_64-pc-linux-gnu) From: Ulrich Mueller 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-Type: multipart/signed; boundary="pgp+signed+M7l4GK3cenGlyQ1"; micalg=pgp-sha256; protocol="application/pgp-signature" X-Archives-Salt: 1503a310-b658-4cb4-a9f2-9cb6cf18d56a X-Archives-Hash: 299bfde9ef594942ba8f6990de4aa84a This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --pgp+signed+M7l4GK3cenGlyQ1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit >>>>> On Mon, 7 Dec 2015, Jason Zaman wrote: > 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 You could use a condition like: if [[ -n $(version_cut 6) ]]; then This assumes that the function would simply return an empty string when trying to read after the last component. Ulrich --pgp+signed+M7l4GK3cenGlyQ1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBCAAGBQJWZTgXAAoJEMMJBoUcYcJzK9QH/1kaA0ZrRZ8pX2fLplYQNRPV w3w39Y03lThXToH/8SPImX9CeIOt/2OaqTZ00SN/j2gSdfkE8BPMDswZBhMUVLbG LA6sYa7XzReKbNJh2BB0ncLDUAz0e9vWpqRfxCJq1O9CycRqcn6Nw6vcAhjFk5Ab MFWGSNGW8mUJI/cDyZZgdTV66dqTqq9OhJt7O+ndCzPyQQ1kuH7bY+knn2w2w3so GBJhl+Djq5OU5bmBFfNjWjmw1b18QhgLTrgEM4sMXdOKE1DdVB+op8h3Q7S6JM33 Jp1/65qW8LOmPJqjFeSABgjjCl1vP8gSPkqO+zYUoMXeOt4g33xJZYkJyP/Su1s= =VMU1 -----END PGP SIGNATURE----- --pgp+signed+M7l4GK3cenGlyQ1--