All of lore.kernel.org
 help / color / mirror / Atom feed
* How to specify a default value for a variable in a recipe
@ 2014-06-13 13:08 Patrick Doyle
  2014-06-13 13:47 ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Doyle @ 2014-06-13 13:08 UTC (permalink / raw)
  To: yocto@yoctoproject.org

OK, I've got to ask this, because it totally confuses me.  I wrote a
recipe to build a custom application (gstreamer plugin, actually) that
I wanted to fetch from our SCM.  Bitbake told me I needed to specify a
source revision and even gave me a clue of what to put in.  Looking at
the development manual, I decided I wanted to use the latest revision
from our repository by default, so I added the following line to my
recipe:

SRCREV_default_pn-gstxbac = "${AUTOREV}"

But now I'm curious.  Why couldn't I use (I haven't tried this yet)

SRCREV_pn-gstxbac ?= "${AUTOREV}"

and even more confusingly, why isn't the syntax something more like:

SRCREV_pn-gstxbac_default = "${AUTOREV}"

What's going on here?

Does one syntax (BLAH_default vs BLAH ?=) get evaluated early in the
bitbake process and the other get evaluated late?

Does the location of the letters "default" in a variable name matter?

At some point, I really need to wrap my head around Bitbake, it's
syntax, and how it operates and internalize all of that.

--wpd


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

* Re: How to specify a default value for a variable in a recipe
  2014-06-13 13:08 How to specify a default value for a variable in a recipe Patrick Doyle
@ 2014-06-13 13:47 ` Gary Thomas
  2014-06-13 14:07   ` Patrick Doyle
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2014-06-13 13:47 UTC (permalink / raw)
  To: yocto

On 2014-06-13 07:08, Patrick Doyle wrote:
> OK, I've got to ask this, because it totally confuses me.  I wrote a
> recipe to build a custom application (gstreamer plugin, actually) that
> I wanted to fetch from our SCM.  Bitbake told me I needed to specify a
> source revision and even gave me a clue of what to put in.  Looking at
> the development manual, I decided I wanted to use the latest revision
> from our repository by default, so I added the following line to my
> recipe:
>
> SRCREV_default_pn-gstxbac = "${AUTOREV}"
>
> But now I'm curious.  Why couldn't I use (I haven't tried this yet)
>
> SRCREV_pn-gstxbac ?= "${AUTOREV}"

If this is in the gstxbac recipe itself, use the much simpler
   SRCREV ?= "${AUTOREV}"

>
> and even more confusingly, why isn't the syntax something more like:
>
> SRCREV_pn-gstxbac_default = "${AUTOREV}"
>
> What's going on here?
>
> Does one syntax (BLAH_default vs BLAH ?=) get evaluated early in the
> bitbake process and the other get evaluated late?
>
> Does the location of the letters "default" in a variable name matter?
>
> At some point, I really need to wrap my head around Bitbake, it's
> syntax, and how it operates and internalize all of that.

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


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

* Re: How to specify a default value for a variable in a recipe
  2014-06-13 13:47 ` Gary Thomas
@ 2014-06-13 14:07   ` Patrick Doyle
  2014-06-13 14:13     ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Doyle @ 2014-06-13 14:07 UTC (permalink / raw)
  To: Gary Thomas; +Cc: yocto@yoctoproject.org

On Fri, Jun 13, 2014 at 9:47 AM, Gary Thomas <gary@mlbassoc.com> wrote:
> If this is in the gstxbac recipe itself, use the much simpler
>   SRCREV ?= "${AUTOREV}"

Even better!  While I like that solution best of all, that opens up a
whole new world of hurt for me.

How does

SRCREV_default_pn-gstxbac = "${AUTOREV}"

work?  When would I use that over the much simpler solution you proposed?

I am thinking that if I used your solution, I might place

SRCREV_pn-gstxbac = "123" (or a git hash, or whatever)

in my local.conf?  in my BSP layer.conf?

I guess I could put

SRCREV_default_pn-gstxbac = "123" in my BSP layer.conf, and then,
later on, on some other project that used the same board, I might put

SRCREV_pn-gstxbac = "${AUTOREV}" in my local.conf, or maybe in a
.bbappend file for my BSP?

How/where does the _pn suffix (middlex?) come into play?

At this point, I like your solution tremendously, as it makes sense to
me.  But I sure would like to understand more about all the myriad
capabilities offered by bitbake.

--wpd


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

* Re: How to specify a default value for a variable in a recipe
  2014-06-13 14:07   ` Patrick Doyle
@ 2014-06-13 14:13     ` Gary Thomas
  2014-06-13 14:33       ` Patrick Doyle
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2014-06-13 14:13 UTC (permalink / raw)
  To: Patrick Doyle; +Cc: yocto@yoctoproject.org

On 2014-06-13 08:07, Patrick Doyle wrote:
> On Fri, Jun 13, 2014 at 9:47 AM, Gary Thomas <gary@mlbassoc.com> wrote:
>> If this is in the gstxbac recipe itself, use the much simpler
>>    SRCREV ?= "${AUTOREV}"
>
> Even better!  While I like that solution best of all, that opens up a
> whole new world of hurt for me.
>
> How does
>
> SRCREV_default_pn-gstxbac = "${AUTOREV}"
>
> work?  When would I use that over the much simpler solution you proposed?
>
> I am thinking that if I used your solution, I might place
>
> SRCREV_pn-gstxbac = "123" (or a git hash, or whatever)
>
> in my local.conf?  in my BSP layer.conf?
>
> I guess I could put
>
> SRCREV_default_pn-gstxbac = "123" in my BSP layer.conf, and then,
> later on, on some other project that used the same board, I might put
>
> SRCREV_pn-gstxbac = "${AUTOREV}" in my local.conf, or maybe in a
> .bbappend file for my BSP?
>
> How/where does the _pn suffix (middlex?) come into play?

Any time you need to set the variable outside of the recipe itself (.bb* or .inc),
then you need the _pn-${recipe} syntax.

>
> At this point, I like your solution tremendously, as it makes sense to
> me.  But I sure would like to understand more about all the myriad
> capabilities offered by bitbake.

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


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

* Re: How to specify a default value for a variable in a recipe
  2014-06-13 14:13     ` Gary Thomas
@ 2014-06-13 14:33       ` Patrick Doyle
  0 siblings, 0 replies; 5+ messages in thread
From: Patrick Doyle @ 2014-06-13 14:33 UTC (permalink / raw)
  To: Gary Thomas; +Cc: yocto@yoctoproject.org

On Fri, Jun 13, 2014 at 10:13 AM, Gary Thomas <gary@mlbassoc.com> wrote:
> Any time you need to set the variable outside of the recipe itself (.bb* or
> .inc),
> then you need the _pn-${recipe} syntax.
Ahhh…. that's good to know.

I keep wanting to understand the scope rules of bitbake.  This helps.

Thanks Gary.

--wpd


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

end of thread, other threads:[~2014-06-13 14:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 13:08 How to specify a default value for a variable in a recipe Patrick Doyle
2014-06-13 13:47 ` Gary Thomas
2014-06-13 14:07   ` Patrick Doyle
2014-06-13 14:13     ` Gary Thomas
2014-06-13 14:33       ` Patrick Doyle

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.