Gentoo Development Guide
The Portage Cache
Portage uses a cache for most top-level variables (DEPEND, DESCRIPTION,
SRC_URI and so on). This cache may be generated on a different machine, so
these variables must be either static or generated using only unchanging
'version / name' variables (P, PN, PV, PR, PVR and PF).
So, the following will not work:
# DO NOT DO THIS!
if ! has_version "x11-libs/gtk+" ; then
DEPEND="${DEPEND}
gtk? ( >=x11-libs/gtk+-2 )
!gtk? ( =x11-libs/gtk+-1.2* )"
fi
However, this is legal, since versionator.eclass works upon PV, and
PV and PN are both static:
inherit versionator
if [[ $(get_major_version) -ge 7 ]] ; then
IUSE="${IUSE} tcltk mzscheme"
DEPEND="${DEPEND}
tcltk? ( dev-lang/tcl )
mzscheme? ( dev-lisp/mzscheme )"
RDEPEND="${RDEPEND}
tcltk? ( dev-lang/tcl )
mzscheme? ( dev-lisp/mzscheme )"
if [[ "${MY_PN}" != "vim-core" ]] ; then
RDEPEND="${RDEPEND} !<app-vim/align-30-r1"
fi
fi
Conditional Inherits
Because eclasses modify various cached variables, conditional inheritance is not
allowed except where the same results will always be obtained on every system.
For example, inherits based upon USE flags are illegal, but inherits based
solely upon PN are allowed.
As an example of a legal and possibly useful conditional inherit, some eclasses do:
if [[ "${PN##*-}" == "cvs" ]] ; then
inherit cvs
fi
This allows the same eclass to be used for both regular and -cvs packages.