Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] multiple inclusion protection with eclasses
Date: Thu, 08 Dec 2011 23:43:59
Message-Id: CAAr7Pr8g-vTDW=KMnr_1Dq5GxBrqhfuwenP4DL+dQ14qa1D3WA@mail.gmail.com
In Reply to: [gentoo-dev] multiple inclusion protection with eclasses by Mike Frysinger
1 On Thu, Dec 8, 2011 at 2:24 PM, Mike Frysinger <vapier@g.o> wrote:
2 > ferringb did some tests and found that doing multiple inclusion protection in
3 > eclasses gets us some nice speed ups.  it isn't nearly as nice as if we had a
4 > way of skipping the `source` altogether, but that that would require PMS/tree
5 > changes.  the change i'm proposing can be implemented $now and should work
6 > with all versions.  PMS extensions can thus be discussed in parallel.
7 >
8 > simply put, it's the same thing as doing standard #ifdef logic in headers to
9 > protect against multiple inclusion errors.  on to the example:
10 >
11 > --- autotools.eclass
12 > +++ autotools.eclass
13 > @@ -10,6 +10,9 @@
14 >  # This eclass is for safely handling autotooled software packages that need
15 >  # regenerate their build scripts.  All functions will abort in case of
16 >
17 > +if [[ ${___ECLASS_ONCE_AUTOTOOLS} != "recur -_+^+_- spank" ]] ; then
18 > +___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank"
19 > +
20
21 Not to rain on your parade; but is that the value you are sticking with?
22
23 -A
24
25 >  inherit eutils libtool
26 >
27 >  # @ECLASS-VARIABLE: WANT_AUTOCONF
28 > @@ -399,3 +402,5 @@
29 >
30 >        echo $include_opts
31 >  }
32 > +
33 > +fi
34 >
35 > this assumes that the eclass in question isn't doing something weird.  for
36 > example, if you had an ebuild today that did:
37 >        inherit eutils
38 >        epatch() { die erp; }
39 >        inherit eutils
40 >
41 > that local epatch() would get reset by the eutils inherit.  but i can't see
42 > any ebuild having a valid reason for doing things like this, so screw 'em.
43 >
44 > i plan on implementing this in the eclasses i generally look over.  i don't
45 > plan on doing it for all eclasses since i'm not familiar with them.
46 > -mike

Replies

Subject Author
Re: [gentoo-dev] multiple inclusion protection with eclasses Mike Frysinger <vapier@g.o>