Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 790422 - [Future EAPI] USE-dependent USE-flag masking
Summary: [Future EAPI] USE-dependent USE-flag masking
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: PMS/EAPI
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: future-eapi
  Show dependency tree
 
Reported: 2021-05-15 20:27 UTC by Matt Turner
Modified: 2024-08-30 15:46 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Turner gentoo-dev 2021-05-15 20:27:45 UTC
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.
Comment 1 Zac Medico gentoo-dev 2021-05-15 20:33:15 UTC
A REQUIRED_USE extension might fit better, since that already specifies relationships between flags.
Comment 2 Eli Schwartz gentoo-dev 2024-08-30 15:40:41 UTC
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.
Comment 3 Eli Schwartz gentoo-dev 2024-08-30 15:46:50 UTC
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.