From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D7FDB1386B3 for ; Sat, 26 Jan 2013 15:29:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9DFB321C00A; Sat, 26 Jan 2013 15:29:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 91448E0458 for ; Sat, 26 Jan 2013 15:29:08 +0000 (UTC) Received: from localhost (pc-234-79-101-190.cm.vtr.net [190.101.79.234]) (using SSLv3 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aballier) by smtp.gentoo.org (Postfix) with ESMTPSA id EEAA333D876; Sat, 26 Jan 2013 15:29:06 +0000 (UTC) Date: Sat, 26 Jan 2013 12:29:01 -0300 From: Alexis Ballier To: gentoo-dev@lists.gentoo.org Cc: mgorny@gentoo.org Subject: Re: [gentoo-dev] [PATCH 2/2] Use new multilib flags in autotools-multilib. Message-ID: <20130126122901.2e9c6aca@gentoo.org> In-Reply-To: <20130126160635.00345b99@pomiocik.lan> References: <1358983437-18752-1-git-send-email-mgorny@gentoo.org> <1358983437-18752-3-git-send-email-mgorny@gentoo.org> <20130123214013.3a4b146f@gentoo.org> <20130126131142.4b70462d@pomiocik.lan> <20130126115122.2c37d80d@gentoo.org> <20130126160635.00345b99@pomiocik.lan> Organization: Gentoo X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.14; x86_64-pc-linux-gnu) 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: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 31a6405b-93c0-49cf-8435-795b2774c2c8 X-Archives-Hash: 8b1eed60c494f70609c52a2071f869ea On Sat, 26 Jan 2013 16:06:35 +0100 Micha=C5=82 G=C3=B3rny wrote: > On Sat, 26 Jan 2013 11:51:22 -0300 > Alexis Ballier wrote: >=20 > > On Sat, 26 Jan 2013 13:11:41 +0100 > > Micha=C5=82 G=C3=B3rny wrote: > >=20 > > > On Wed, 23 Jan 2013 21:40:13 -0300 > > > Alexis Ballier wrote: > > >=20 > > > > On Thu, 24 Jan 2013 00:23:57 +0100 > > > > Micha=C5=82 G=C3=B3rny wrote: > > > >=20 > > > > > This is mostly a proof-of-concept. If approved, I will work on > > > > > moving the code into a separate eclass, possibly named > > > > > 'multilib-build' ;). --- > > > > > gx86/eclass/autotools-multilib.eclass | 24 > > > > > +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 > > > > > deletions(-) > > > > >=20 > > > > > diff --git a/gx86/eclass/autotools-multilib.eclass > > > > > b/gx86/eclass/autotools-multilib.eclass index 7c8697a..eef7bcc > > > > > 100644 --- a/gx86/eclass/autotools-multilib.eclass > > > > > +++ b/gx86/eclass/autotools-multilib.eclass > > > > > @@ -32,7 +32,23 @@ inherit autotools-utils multilib > > > > > =20 > > > > > EXPORT_FUNCTIONS src_configure src_compile src_test > > > > > src_install=20 > > > > > -IUSE=3Dmultilib > > > > > +# Declare all of them, profiles will control their > > > > > visibility. +IUSE=3D'abi_x86_32 abi_x86_64' > > > > > + > > > > > +# @FUNCTION: _autotools-multilib_get_enabled_abis > > > > > +# @DESCRIPTION: > > > > > +# Get the list of enabled ABIs. The returned names are > > > > > suitable for use +# with multilib.eclass. > > > > > +# > > > > > +# If multilib is not enabled or not supported, returns an > > > > > empty list. + > > > > > + debug-print-function ${FUNCNAME} "${@}" > > > > > + > > > > > + if use amd64; then > > > > > + use abi_x86_64 && echo amd64 > > > > > + use abi_x86_32 && echo x86 > > > > > + fi > > > > > +} > > > >=20 > > > > I would rather iterate over a variable than hardcoding and > > > > duplicating it here: > > > >=20 > > > > MULTILIB_ABIS=3D'abi_x86_32:x86 abi_x86_64:amd64' > > > > IUSE=3D"" > > > > for i in $MULTILIB_ABIS ; do > > > > IUSE+=3D" ${i%:*}" > > > > done > > > >=20 > > > > _autotools-multilib_get_enabled_abis() { > > > > for i in $MULTILIB_ABIS ; do > > > > use ${i%:*} && echo ${i#*:} > > > > done > > > > } > > >=20 > > > What are the advantages? I feel like the explicit solution is much > > > more readable and obvious at the first glance. > >=20 > > yes it is more readable but IMHO it's better to avoid to have to > > touch multiple places when adding a new ABI: you only have to > > document that adding a new ABI consists simply in adding it to this > > list (and document the useflag) instead of 'add the useflag, add > > support for it to function foo and bar, etc.' > > your call in the end, but I fear not trying to separate code from > > data could make the eclass harder to maintain. >=20 > Ok, separating data from code seems a valid concern. However, I feel > like this is not really clear concept in bash, and the intent is that > the ABI list will be used only in that function. makes sense; the foo:bar trick is what I've came up in trying to emulate python dictionaries :) > > also, IMHO you shouldn't use arch to guess what useflag to check or > > not: they'll all be in IUSE in the end and the profiles should be > > the one deciding what to mask or not (which you'll have to do > > anyway), not the eclass. >=20 > Well, I think I've stated that already. That 'use foo &&' is just > an optimization hack -- to not check all the irrelevant flags all > the time. I'm not sure 'optimizations' are relevant when we're going to build twice the package here :P Also, # of arches is about the same order of magnitude than # of abis, thus checking # of arches time use $arch or # of abis times use $abi is, in the end, comparable while checking arch adds the constraint that the eclass and the profiles have to be in sync. Alexis.