Re: Should we change variable override formatting?

Mark Hatle

On 7/16/21 11:28 AM, Richard Purdie wrote:
On Fri, 2021-07-16 at 14:35 +0000, Peter Kjellerstedt wrote:
(trimmed to add a minor comment)

As to RDEPENDS_${PN} & co, wouldn't it make sense to use RDEPENDS_pn-${PN},
since "pn-<package name>" already exists as an override? 
PN is really badly named since it is effectively the recipe name in many 
contexts. We're specifying one single thing in overrides with it rather than
a suite of packages a recipe generates. I can't see how using pn- like that
would work for the use cases we have for the package name override.
In this case ${PN} is just a name. It's because PACKAGES contains ${PN} by default.

Really it's RDEPENDS_<package>. Which is distinctly different then
RDEPENDS_pn-${PN} which is 'RDEPENDS' when evaluated.

I know minor distinction, but this is why I don't advocate treating RDEPENDS
(and other package specific variables) as overrides, but instead think of this
as RDEPENDS_<package>_<operation/override>...

So with proposed syntax becomes RDEPENDS_<package>:operation/override

On that note,
I would like to see overrides being prefixed more (maybe even as a
requirement). Some suggestions:

pn- - Package name
df- - Distro feature
mf- - Machine feature
pf- - Package feature (can we rename/alias PACKAGECONFIG to
          PACKAGE_FEATURES while at it, for consistency?)
arch- - Architecture
dist- - Distribution

That way it would be more obvious what an override does. Especially the
use of the distro name as an override can have some unforeseen consequences
if the name is somewhat common).
We have tried to do this with newer overrides where it makes sense. It is 
a tradeoff between longer names and usability. I don't think adding something
for the package name would help. Having "distro-" and "machine-" could
help in some cases but it comes at the price of more complicated conversions
and it becomes a question of whether things become more readable. Worth thinking
about but the above list doesn't really make sense since features are in overrides.
I've definitely run into problems where distro name or machine name collided
with a different override in the past and took a long time for me to realize the
clash was happening and thus the wrong variables were being evaluated.


(PACKAGECONFIG should really be RECIPE_FEATURES if we're going to talk names!)



Join { to automatically receive all group messages.