From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RYn3v-0007Da-3V for garchives@archives.gentoo.org; Thu, 08 Dec 2011 23:07:38 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B2A9D21C08A for ; Thu, 8 Dec 2011 23:07:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 00A1221C088 for ; Thu, 8 Dec 2011 22:24:01 +0000 (UTC) Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 6D1471B400E for ; Thu, 8 Dec 2011 22:24:01 +0000 (UTC) From: Mike Frysinger Organization: wh0rd.org To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] multiple inclusion protection with eclasses Date: Thu, 8 Dec 2011 17:24:09 -0500 User-Agent: KMail/1.13.7 (Linux/3.1.0-atsc; KDE/4.6.5; x86_64; ; ) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5238301.ZlhWpf8QQN"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201112081724.09591.vapier@gentoo.org> X-Archives-Salt: dfa536db-e00b-4a9a-8cd4-d5db81bb7116 X-Archives-Hash: 18dab542c1c59873f8cb68c96cdf6619 --nextPart5238301.ZlhWpf8QQN Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable ferringb did some tests and found that doing multiple inclusion protection = in=20 eclasses gets us some nice speed ups. it isn't nearly as nice as if we had= a=20 way of skipping the `source` altogether, but that that would require PMS/tr= ee=20 changes. the change i'm proposing can be implemented $now and should work= =20 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 t= o=20 protect against multiple inclusion errors. on to the example: =2D-- 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 =20 +if [[ ${___ECLASS_ONCE_AUTOTOOLS} !=3D "recur -_+^+_- spank" ]] ; then +___ECLASS_ONCE_AUTOTOOLS=3D"recur -_+^+_- spank" + inherit eutils libtool =20 # @ECLASS-VARIABLE: WANT_AUTOCONF @@ -399,3 +402,5 @@ =20 echo $include_opts } + +fi this assumes that the eclass in question isn't doing something weird. for= =20 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= =20 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= =20 plan on doing it for all eclasses since i'm not familiar with them. =2Dmike --nextPart5238301.ZlhWpf8QQN Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJO4TkJAAoJEEFjO5/oN/WByv8P+gOzN46k+DkPn8Y2N6+xnzR6 Tws5N4eU/HTyK4EImRdRa0qbPu5F25RFVIHjGMVjpL9XbaLBtIYTjnq8wEmlMWJz KUM8thnChYLnMzuY50iuX/BeX1xY1nOWdknSdo0UhQVtLkQMWLYWy3STBiBwGsCQ 0wkE1BXyBIRmIkDwu5lEZefWMF47znKN/BTdkj04FM/DO2yesZZbn5lsin89sEnc 1UYHrOYJXqanLJfAJPp31R0zmAWtXbbFvPv323fJBfLV9JC+vWDczVgcj7itS5K+ k7xMp5jjxF3emUBzQUPCeqYT3vl0IiCmoImSSMuoSuWgtXrYnVDRK2bPVMo7tig9 E1ioBk9+qHhOCV2mH2T/1qj+VfFq+laShdVfsUaaUBEO7OFEvNUo0/5dpzvVXN87 8Y7sCTrFGVJW+jcj+pDNCZBM1uL8oUnBvATu0NBu0rsI4ah6jGLtbEjTI8OHjQGM gd0oM6O3348uATA4IOANp0Cqi4Dp+vNjmU4tFReeFa80k0tCzpyWtLYUUvh9TuRl MGazi6vu9eAztRjJzwKRIY/6eDHYJxvTEl6wH/hTF3YYkG3BvuwPwByRKYsCdDOD DuG++3g8Cq5w++aLXYP7gvj/hIP9whacsiLx8uvkO5GJo5D7lMfxqNoORmJ4osRF 3KMA52vIKm7p3HDYV8as =8Ihc -----END PGP SIGNATURE----- --nextPart5238301.ZlhWpf8QQN--