public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org,Jason Zaman <perfinion@gentoo.org>
Subject: Re: [gentoo-dev] RFD: Replacement for versionator.eclass in PMS (for EAPI 7?)
Date: Mon, 07 Dec 2015 08:00:32 +0100	[thread overview]
Message-ID: <FA9FC2F9-A552-4CE5-98BA-3F2A83CC989D@gentoo.org> (raw)
In-Reply-To: <20151207053750.GA23517@meriadoc>



Dnia 7 grudnia 2015 06:37:50 CET, Jason Zaman <perfinion@gentoo.org> 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.


  reply	other threads:[~2015-12-07  7:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-28 21:14 [gentoo-dev] RFD: Replacement for versionator.eclass in PMS (for EAPI 7?) Ulrich Mueller
2015-11-29 23:23 ` Peter Stuge
2015-11-30  6:28   ` Michał Górny
2015-12-02 11:03 ` Alexis Ballier
2015-12-02 12:04   ` Ulrich Mueller
2015-12-02 12:18     ` Alexis Ballier
2015-12-07  5:37 ` Jason Zaman
2015-12-07  7:00   ` Michał Górny [this message]
2015-12-07  7:41   ` Ulrich Mueller

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=FA9FC2F9-A552-4CE5-98BA-3F2A83CC989D@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=perfinion@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