As author of a recipe, I would like to have means to ensure that certain variables are set. The current approach is to initialise the variable to a known value that is outside the range of valid parameters and then perform a check later on. This is where I think it would be more efficient and robust to have bitbake supporting poisoning. The approaches could be 2: a) let the user do something like: MY_PRE_POISONED_VARIABLE ??= "DEADBEEF" b) pre-initialize very variable to the poisoned value, like: AUTO_POISONING='True' which would be the equivalent of: RANDOM_VARIABLE ???= "DEADBEEF" Either way, an error would be triggered whenever accessing a poisoned variable.
Could you give a bit more information about what kinds of problems you're seeing here? There are a few different ways this could possibly be implemented but that really depends on the exact problem which is being addressed. You can today tell whether a value is set if you use anonymous python by seeing if the return value of getVar is None. If it is None, you know it wasn't set. I'd much prefer checking for that value rather than adding poisoning support to bitbake.
Assign to Igor for more info.
Yes, I could do as proposed, but what I'm after is to avoid having to add custom code for the check. The scenario I have in mind would be: when creating a recipe, I declare one or more variables as poisoned and then I do not have to worry about when they are used. The first time they are used without being initialised, I get an ERROR. IOW I would like to move the burden of the verification on the tool, instead than on the author of the recipe. Does this clarify the rationale?
Back to original state and assignee.
The trouble is we need to have consistent behaviour on how we handle default values. Most class code or similar checks for values and errors if they are unset. Adding in a new mechanism for such values would likely confuse more than it would help and we're unlikely to want to use poison values for many of our defaults.