Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@×××××.com>
To: Zac Medico <zmedico@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFD : .ebuild is only bash
Date: Wed, 14 Mar 2012 02:39:23
Message-Id: 20120314023814.GC7731@localhost
In Reply to: Re: [gentoo-dev] RFD : .ebuild is only bash by Zac Medico
1 On Tue, Mar 13, 2012 at 07:05:57PM -0700, Zac Medico wrote:
2 > On 03/13/2012 06:42 PM, Brian Harring wrote:
3 > > Leaving it such that the PM has to enforce things like "don't have
4 > > multiple EAPI assignments" means by default, one of them isn't going
5 > > to... leading to the ebuilds breaking... specifically the common case
6 > > being the ebuild becoming acclimated to some quirk of portage.
7 >
8 > My intention is for PMS to specify the search algorithm that's used to
9 > probe the EAPI, and also for it to specify that package managers must
10 > treat an ebuild as invalid if the probed EAPI is not identical to the
11 > one that's obtained from bash.
12
13 *Now* is when you should be applying your KISS wikipedia links
14 (moreso, the principle applied to your proposal).
15
16 What you're talking about is requiring PMs to monitor what occured
17 and bail- rather than precluding it from even occuring. I repeat; try
18 to spot the situation and make things blow up, rather than disallowing
19 it from occuring in the first place.
20
21 It's really that simple; this is why the "grep the assignment" out of
22 the source is at its core, a well intentioned but fundamentally bad
23 idea. It's glue on a bad situation rather than just removing the bad
24 situation.
25
26
27 > If all package managers adhere strictly
28 > to these two requirements, then we won't have any incompatibilities
29 > between package managers here.
30
31 You're missing a lot of the point here; defining some search algo is
32 basically screwed at its core due to the flexibility of bash. Simple
33 example:
34
35 if [ "$PV" -eq 9999 ]; then
36 EAPI=3
37 else
38 EAPI=2
39 fi
40
41 The flexibility of bash means that your attempt to enforce simplistic
42 rules like "it must be greppable" are at loggerheads; if the rules
43 were "last is the one thats used", then I just invert the if check.
44
45 Yep, the above is stupid code. Frankly, the sort of stupid code
46 I'd expect out of a newbie ebuild dev. The EAPI bit there is
47 synthetic, but that sort of construct (putting everything into a
48 single file, then using symlinks to expose differing versions) is out
49 in the wild and used.
50
51 The fact that potential exists is a flat out sign the approach is
52 broken. Worse, it's a way to trip up people- specifically new devs
53 who don't know fun rules like "the PM has this lovely search algo for
54 getting EAPI that you must abide by".
55
56 ~brian

Replies

Subject Author
Re: [gentoo-dev] RFD : .ebuild is only bash Zac Medico <zmedico@g.o>