* [gentoo-dev] multiple inclusion protection with eclasses
@ 2011-12-08 22:24 Mike Frysinger
2011-12-08 23:42 ` Alec Warner
2011-12-09 4:40 ` Michał Górny
0 siblings, 2 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-12-08 22:24 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1493 bytes --]
ferringb did some tests and found that doing multiple inclusion protection in
eclasses gets us some nice speed ups. it isn't nearly as nice as if we had a
way of skipping the `source` altogether, but that that would require PMS/tree
changes. the change i'm proposing can be implemented $now and should work
with all versions. PMS extensions can thus be discussed in parallel.
simply put, it's the same thing as doing standard #ifdef logic in headers to
protect against multiple inclusion errors. on to the example:
--- autotools.eclass
+++ autotools.eclass
@@ -10,6 +10,9 @@
# This eclass is for safely handling autotooled software packages that need
# regenerate their build scripts. All functions will abort in case of
+if [[ ${___ECLASS_ONCE_AUTOTOOLS} != "recur -_+^+_- spank" ]] ; then
+___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank"
+
inherit eutils libtool
# @ECLASS-VARIABLE: WANT_AUTOCONF
@@ -399,3 +402,5 @@
echo $include_opts
}
+
+fi
this assumes that the eclass in question isn't doing something weird. for
example, if you had an ebuild today that did:
inherit eutils
epatch() { die erp; }
inherit eutils
that local epatch() would get reset by the eutils inherit. but i can't see
any ebuild having a valid reason for doing things like this, so screw 'em.
i plan on implementing this in the eclasses i generally look over. i don't
plan on doing it for all eclasses since i'm not familiar with them.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] multiple inclusion protection with eclasses
2011-12-08 22:24 [gentoo-dev] multiple inclusion protection with eclasses Mike Frysinger
@ 2011-12-08 23:42 ` Alec Warner
2011-12-08 23:53 ` Mike Frysinger
2011-12-09 4:40 ` Michał Górny
1 sibling, 1 reply; 6+ messages in thread
From: Alec Warner @ 2011-12-08 23:42 UTC (permalink / raw
To: gentoo-dev
On Thu, Dec 8, 2011 at 2:24 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> ferringb did some tests and found that doing multiple inclusion protection in
> eclasses gets us some nice speed ups. it isn't nearly as nice as if we had a
> way of skipping the `source` altogether, but that that would require PMS/tree
> changes. the change i'm proposing can be implemented $now and should work
> with all versions. PMS extensions can thus be discussed in parallel.
>
> simply put, it's the same thing as doing standard #ifdef logic in headers to
> protect against multiple inclusion errors. on to the example:
>
> --- autotools.eclass
> +++ autotools.eclass
> @@ -10,6 +10,9 @@
> # This eclass is for safely handling autotooled software packages that need
> # regenerate their build scripts. All functions will abort in case of
>
> +if [[ ${___ECLASS_ONCE_AUTOTOOLS} != "recur -_+^+_- spank" ]] ; then
> +___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank"
> +
Not to rain on your parade; but is that the value you are sticking with?
-A
> inherit eutils libtool
>
> # @ECLASS-VARIABLE: WANT_AUTOCONF
> @@ -399,3 +402,5 @@
>
> echo $include_opts
> }
> +
> +fi
>
> this assumes that the eclass in question isn't doing something weird. for
> example, if you had an ebuild today that did:
> inherit eutils
> epatch() { die erp; }
> inherit eutils
>
> that local epatch() would get reset by the eutils inherit. but i can't see
> any ebuild having a valid reason for doing things like this, so screw 'em.
>
> i plan on implementing this in the eclasses i generally look over. i don't
> plan on doing it for all eclasses since i'm not familiar with them.
> -mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] multiple inclusion protection with eclasses
2011-12-08 23:42 ` Alec Warner
@ 2011-12-08 23:53 ` Mike Frysinger
0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-12-08 23:53 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: Text/Plain, Size: 532 bytes --]
On Thursday 08 December 2011 18:42:54 Alec Warner wrote:
> On Thu, Dec 8, 2011 at 2:24 PM, Mike Frysinger wrote:
> > +if [[ ${___ECLASS_ONCE_AUTOTOOLS} != "recur -_+^+_- spank" ]] ; then
> > +___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank"
>
> Not to rain on your parade; but is that the value you are sticking with?
i could insert "antarus" and "goat" if you like. point is simply to pick a
variable name and value that are highly unlikely for the user to accidentally
set. and if they did, well foo on them.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] multiple inclusion protection with eclasses
2011-12-08 22:24 [gentoo-dev] multiple inclusion protection with eclasses Mike Frysinger
2011-12-08 23:42 ` Alec Warner
@ 2011-12-09 4:40 ` Michał Górny
2011-12-09 17:02 ` Mike Frysinger
1 sibling, 1 reply; 6+ messages in thread
From: Michał Górny @ 2011-12-09 4:40 UTC (permalink / raw
To: gentoo-dev; +Cc: vapier
[-- Attachment #1: Type: text/plain, Size: 419 bytes --]
On Thu, 8 Dec 2011 17:24:09 -0500
Mike Frysinger <vapier@gentoo.org> wrote:
> simply put, it's the same thing as doing standard #ifdef logic in
> headers to protect against multiple inclusion errors. on to the
> example:
>
> +___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank"
If you want alike CPP, why don't you name it:
_AUTOTOOLS_ECLASS=1
Looks unlikely enough.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] multiple inclusion protection with eclasses
2011-12-09 4:40 ` Michał Górny
@ 2011-12-09 17:02 ` Mike Frysinger
2011-12-09 18:01 ` Alec Warner
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2011-12-09 17:02 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: Text/Plain, Size: 465 bytes --]
On Thursday 08 December 2011 23:40:12 Michał Górny wrote:
> On Thu, 8 Dec 2011 17:24:09 -0500 Mike Frysinger wrote:
> > simply put, it's the same thing as doing standard #ifdef logic in
> > headers to protect against multiple inclusion errors. on to the
> > example:
> >
> > +___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank"
>
> If you want alike CPP, why don't you name it:
> _AUTOTOOLS_ECLASS=1
that's not my preferred CPP naming style :p
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] multiple inclusion protection with eclasses
2011-12-09 17:02 ` Mike Frysinger
@ 2011-12-09 18:01 ` Alec Warner
0 siblings, 0 replies; 6+ messages in thread
From: Alec Warner @ 2011-12-09 18:01 UTC (permalink / raw
To: gentoo-dev
I'd prefer something from figlet myself.
-A
On Fri, Dec 9, 2011 at 9:02 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Thursday 08 December 2011 23:40:12 Michał Górny wrote:
>> On Thu, 8 Dec 2011 17:24:09 -0500 Mike Frysinger wrote:
>> > simply put, it's the same thing as doing standard #ifdef logic in
>> > headers to protect against multiple inclusion errors. on to the
>> > example:
>> >
>> > +___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank"
>>
>> If you want alike CPP, why don't you name it:
>> _AUTOTOOLS_ECLASS=1
>
> that's not my preferred CPP naming style :p
> -mike
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-12-09 18:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08 22:24 [gentoo-dev] multiple inclusion protection with eclasses Mike Frysinger
2011-12-08 23:42 ` Alec Warner
2011-12-08 23:53 ` Mike Frysinger
2011-12-09 4:40 ` Michał Górny
2011-12-09 17:02 ` Mike Frysinger
2011-12-09 18:01 ` Alec Warner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox