Ciaran McCreesh’s Blag
Now with 17% more caffeine
EAPI 3: Use Dependency Defaults
This is part of a series on EAPI 3.
In EAPI 2, use dependencies are only allowed to reference USE flags that are listed in IUSE for every package that matches the associated specification. Unfortunately, this isn’t enforced, and developers often forget to pay special attention to it.
Use dependency defaults provide a way of saying “if this flag isn’t listed in IUSE, pretend that it had this value instead”. The syntax is to append (+) to the use flag name (the parentheses aren’t entirely pretty, but they’re necessary to avoid ambiguity) if the package manager should pretend that it is on if not present, and (-) if the package manager should pretend that it is off. So, one can do things like foo/bar[baz(+)] or foo/bar[!baz(+)?].
Because of EAPIs before 3 not being strict about what ends up in IUSE, there are still limitations. This can only be used on flags that would be listed in IUSE were they supported; it is not usable for USE_EXPAND values.
Use dependency defaults still require a degree of care from the developer. In particular, it’s not possible to write ‘pre-emptive’ defaults to handle future possible use flag removals; one does not know whether a use flag removal will be because it is always on or because a feature will be removed.
Use dependency defaults first appeared in exheres-0.
Pingback: What’s in EAPI 3? « Ciaran McCreesh’s Blag
Pingback: EAPI 3: Profile Controlled IUSE Injection « Ciaran McCreesh’s Blag