It would be very nice to be able to specify that some USE flags are only meaningful in the presence of another USE flag. For example dev-vcs/git has IUSE=perforce which requires Python. Python support is not needed otherwise. By default some PYTHON_SINGLE_TARGET is enabled, and when the default target changes (e.g. in the profile) emerge --newuse will trigger a rebuild of dev-vcs/git even if USE=-perforce and thus Python isn't used. Just as a simple strawman, I'd propose some new syntax like IUSE="... perforce? ( python_single_target_python3_{7..9} ) ..." And emerge --verbose output would perhaps indicate that the flags are dependent: [ebuild R ] dev-vcs/git-2.26.3::gentoo USE="blksha1 curl gnome-keyring gpg iconv nls pcre pcre-jit perl subversion threads webdav -cgi -cvs -doc -emacs -highlight -mediawiki -mediawiki-experimental -perforce (-ppcsha1) -test -tk -xinetd" perforce? ( PYTHON_SINGLE_TARGET="-python3_7 -python3_8" ) Probably a better way to display that. Suggestions welcome.
A REQUIRED_USE extension might fit better, since that already specifies relationships between flags.
I independently thought about the topic and found this bug when searching for existing proposals. GLEP 73 is related but a very complicated way to solve the problem and doesn't seem to be progressing... (In reply to Zac Medico from comment #1) > A REQUIRED_USE extension might fit better, since that already specifies > relationships between flags. My original idea didn't use IUSE but rather MASKED_USE="python? ( python_single_target_python3_{7..9} )" Making it part of REQUIRED_USE itself doesn't make sense IMO. In the case of REQUIRED, it is up to the user to say what they want and guarantee it is available. The PM doesn't know (absent GLEP 73 "guess a suitable default") which implementation you actually want, just that you do want one. But in the case of MASKED, the PM knows with 100% accuracy what you want: you want to mark all python_single_target_python3_{7..9} flags as disabled, since they are not *checked* by any ebuild code when USE="-python". There should be no guesswork involved. It's a direct instruction that all these USE flags shall be toggled off.
This functionality would also be very useful for binary repositories to avoid cache key failures, since packages without USE=python are still tied to some arbitrary value of PYTHON_TARGETS / PYTHON_SINGLE_TARGET at the time of building. Also, it's not just python that this is relevant to, but other programming languages that can be optionally supported by a package: llvm, lua, ruby, php, postgres, and now guile as well.