Skip to contentSkip to conversation

Query configuration

DISCUSSION Gary Thomas 2 participants 3 messages Nov 19, 2015

lore
Share & tools
lore
#0 lore raw

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
------------------------------------------------------------
#1 lore raw
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
------------------------------------------------------------
#2 lore raw

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
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

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