Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFD: Replacement for versionator.eclass in PMS (for EAPI 7?)
Date: Mon, 07 Dec 2015 07:41:25
Message-Id: 22117.14361.364844.986597@a1i15.kph.uni-mainz.de
In Reply to: Re: [gentoo-dev] RFD: Replacement for versionator.eclass in PMS (for EAPI 7?) by Jason Zaman
1 >>>>> On Mon, 7 Dec 2015, Jason Zaman wrote:
2
3 > Can we also have get_version_component_count() in there?
4
5 > I have a package that likes to change the number of parts so I need
6 > to know how many parts before I can split it up.
7
8 > Basically this:
9 > if [[ $(get_version_component_count) -eq 6 ]]; then
10 > STUDIO_V=$(get_version_component_range 1-4)
11 > BUILD_V=$(get_version_component_range 5-6)
12 > else
13 > STUDIO_V=$(get_version_component_range 1-3)
14 > BUILD_V=$(get_version_component_range 4-5)
15 > fi
16
17 You could use a condition like:
18
19 if [[ -n $(version_cut 6) ]]; then
20
21 This assumes that the function would simply return an empty string
22 when trying to read after the last component.
23
24 Ulrich