Query configuration
I have a recipe that needs to make sure a global setting is in place (used by a different recipe). How can I test for this variable/setting in my recipe and issue a warning/error if it is not?
Thanks for any ideas
Signature · 4 lines
------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------
Quoted 7 lines · Gary Thomas
I have a recipe that needs to make sure a global setting is in place (used by a different recipe). How can I test for this variable/setting in my recipe and issue a warning/error if it is not?
Thanks for any ideas
Never mind - it occurred to me to see if some other recipe had such checks and I found some and was able to add this to my recipe:
# Make sure SPI will is enabled
python do_check_variables() {
ENABLE_SPI_BUS = d.getVar('ENABLE_SPI_BUS', True)
if ENABLE_SPI_BUS != '1':
bb.fatal("PiFace module can't work without SPI support - Add ENABLE_SPI_BUS='1' to local.conf")
}
addtask check_variables before do_fetch
Not sure if this is the best way but it suffices.
Signature · 4 lines
------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------
Hi Gary,
Quoted 19 lines · On Thursday 19 November 2015 10:01:36 Gary Thomas wrote:
Quoted 6 lines · Gary Thomas
I have a recipe that needs to make sure a global setting is in place (used by a different recipe). How can I test for this variable/setting in my recipe and issue a warning/error if it is not?
Thanks for any ideas
Never mind - it occurred to me to see if some other recipe had such checks and I found some and was able to add this to my recipe:
# Make sure SPI will is enabled
pythondo_check_variables(){
ENABLE_SPI_BUS=d.getVar('ENABLE_SPI_BUS', True)
ifENABLE_SPI_BUS!= '1':
bb.fatal("PiFace module can't work without SPI support - Add
ENABLE_SPI_BUS='1' to local.conf") }
addtaskcheck_variablesbeforedo_fetch
Quoted 1 line
Not sure if this is the best way but it suffices.
Another thing you could do would be to do a similar thing except use anonymous python and raise SkipRecipe instead of bb.fatal().
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre