All of lore.kernel.org
 help / color / mirror / Atom feed
* Query configuration
@ 2015-11-19 16:42 Gary Thomas
  2015-11-19 17:01 ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2015-11-19 16:42 UTC (permalink / raw)
  To: Yocto Project

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

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query configuration
  2015-11-19 16:42 Query configuration Gary Thomas
@ 2015-11-19 17:01 ` Gary Thomas
  2015-11-19 17:22   ` Paul Eggleton
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2015-11-19 17:01 UTC (permalink / raw)
  To: yocto

On 2015-11-19 09:42, Gary Thomas wrote:
> 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.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query configuration
  2015-11-19 17:01 ` Gary Thomas
@ 2015-11-19 17:22   ` Paul Eggleton
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-11-19 17:22 UTC (permalink / raw)
  To: Gary Thomas; +Cc: yocto

Hi Gary,

On Thursday 19 November 2015 10:01:36 Gary Thomas wrote:
> On 2015-11-19 09:42, Gary Thomas wrote:
> > 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.

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

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-19 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 16:42 Query configuration Gary Thomas
2015-11-19 17:01 ` Gary Thomas
2015-11-19 17:22   ` Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.