Gentoo Archives: gentoo-dev

From: Kent Fredric <kentnl@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] eapi7-ver.eclass: 'Early adopter' version of EAPI 7 version manip
Date: Sat, 09 Sep 2017 17:06:13
Message-Id: 20170910050520.27b7089b@katipo2.lan
In Reply to: Re: [gentoo-dev] [PATCH] eapi7-ver.eclass: 'Early adopter' version of EAPI 7 version manip by "Michał Górny"
1 On Sat, 09 Sep 2017 17:54:52 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > I'm not sure if there's a serious proposal behind all this but I suppose
5 > it's all just perl-specific insanity that is of no value to everyone
6 > else.
7
8 Yeah, some of the stuff I suggested there are generalisations, because
9 it doesn't make sense to suggest such a feature and have it be
10 *excusively* for Perl usage.
11
12 Pretty much 100% of our usage would be just the 3-position + truncate form.
13
14 So:
15
16 $(ver_fixlen $(ver_3float ${PV}) 3)
17
18 Or something would be most of it.
19
20 We'd probably just keep doing what we're doing with hard-normalization
21 + hard-version-maps, mostly because its more obvious what is going on.
22
23 But we do have people who keep wanting something that maps $PV to
24 upstream, and the existing tools to do that aren't /quite/ ideal.
25
26 NB: Above, the simplified tools are:
27
28 ver_fixlen $version $length
29
30 - ensure everything after first '.' are numbers
31 - make sure there are at most $length characters after '.'
32 - if characters over $length limit are not '0', error.
33 - truncate extraneous 0's beyond $length limit
34 - if the remaining number of digits after the '.' is less than $length, 0-pad
35
36
37 ver_3float $version
38
39 - assume every group after the first '.' are the range 0-999
40 - expand every group to 3 digits , so 0 == 000, 1 == 001, 10 == 010, etc.
41 - concatenate all minor groups
42 - emit ${first}.${minor_groups}
43
44 I think those two would be all perl people might have a use for.
45
46 ( Again, wouldn't be something we'd deploy at volume in
47 perl-module.eclass, would only be for the people who wanted to
48 simplify their own custom maintenance outside the perl herd )
49
50 I really only suggested these sorts of things because I figured "its
51 going to be in an EAPI? maybe the implementation might be in python?,
52 doing this sort of thing in python might actually be viable, whereas
53 its a terrible nightmare to do this kind of string manipulation in bash"
54
55 Though I figure its possible to in bash, I'm just not insane enough to
56 try (yet, getting there)