On Fri, Mar 23, 2012 at 10:09 AM, Alexandre Rostovtsev <tetrom...@gentoo.org> wrote: > On Fri, 2012-03-23 at 12:50 -0400, Mike Gilbert wrote: >> On Fri, Mar 23, 2012 at 12:02 PM, Ciaran McCreesh >> <ciaran.mccre...@googlemail.com> wrote: >> > On Fri, 23 Mar 2012 11:58:47 -0400 >> > Mike Gilbert <flop...@gentoo.org> wrote: >> >> > oasis_src_compile() { >> >> > oasis_src_compile_no_doc >> >> > if has doc ${IUSE} && use doc; then >> >> > ocaml setup.ml -doc || die >> >> > fi >> >> > } >> >> >> >> This should probably call use_if_iuse from eutils.eclass, which >> >> handles IUSE="[+-]doc". >> > >> > Actually, neither way works. The spec says: >> > >> > Global variables must only contain invariant values >> > (see~\ref{sec:metadata-invariance}). If a global variable's value is >> > invariant, it may have the value that would be generated at any >> > given point in the build sequence. >> > >> > So you can't rely upon IUSE having the "merged" value in an eclass. >> > >> >> use_if_iuse is called from functions in several eclasses already in >> the tree. See chromium, kde4-base, qt4-build, and toolchain. >> >> Are all of these usages incorrect? Do you have an alternate solution? > > By my count, there are already at least 19 eclasses in the tree that > access an ebuild's IUSE from eclass code (autotools-utils, chromium, > clutter, db, enlightenment, eutils, gnome2, gnome-python-common, > java-ant-2, java-pkg-2, java-utils-2, mozconfig-3, pam, qt4-build, > qt4-r2, ruby-ng, xfconf, x-modular, and xorg-2).
Lets be clear here. Just because we do already it does not mean we should keep doing it. In general if you are going to say 'this usage is wrong' then you need some kind of tool to detect and report on it; otherwise a subset of developers will get it wrong. Don't make it easy to do the wrong thing, make it easy to do the right thing. -A > > -Alexandre Rostovtsev. > >