The conditional variable expansion syntax that you are using requires OVERRIDES variable, you can check details here.
But the example you provided is not correct and cannot be used.
The principle of OVERRIDES is just when you want to override a variable condionally based on some key.
But, I will suggest something more suitable for your case, which is Variable Flags.
Here is an example:
VARIABLE[dev] = "dev value"
VARIABLE[prod] = "prod value"
Now if you use a Shell based task you can use Python expansion:
do_compile(){
bbwarn ${@d.getVarFlags("VARIABLE").get('dev')}
}
This should show a warning with the value "dev value"
You can then make it more conditional using another variable, for example:
PROJECT_TYPE = "dev"
do_compile(){
bbwarn ${@d.getVarFlags("VARIABLE").get(d.getVar('PROJECT_TYPE'))}
}
You can use a python task directly for more flexible python syntax.
Advice: use logging.bbclass utilities to make the log:
Shell: bbinfo, bbwarn, bberror, ...
Python: bb.info, bb.warn, bb.error, ...
Update:
Loop through the flags with shell for loop:
flags="${@''.join(' ' + flag for flag, _ in d.getVarFlags('PACKAGECONFIG').items())}"
for flag in $flags; do
bbwarn "$flag"
done