All of lore.kernel.org
 help / color / mirror / Atom feed
* Expansion of variables inside do_package_prepend task
@ 2018-02-21 15:50 Iván Castell
  2018-02-21 16:17 ` Joshua Watt
  0 siblings, 1 reply; 3+ messages in thread
From: Iván Castell @ 2018-02-21 15:50 UTC (permalink / raw)
  To: Yocto Project

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

Hello forum.

I have a question regarding the expansion of variables in a recipe. Suppose
I have a recipe with this "do_install" task defined:

    do_install() {
        BBB = ${WORKDIR}
    }

Variable BBB expands to the proper working directory.

    $ bitbake -e <myrecipe> | grep BBB
    BBB = /path/to/working/directory


However, suppose now I have a recipe with this "do_package_prepend" task
defined:

    do_package_prepend() {
        AAA = ${WORKDIR}
    }

Variable AAA doesn't expand to the expected working directory. In fact, it
generates an error:

    $ bitbake -e <myrecipe> | grep AAA
    AAA = ${WORKDIR}
          ^
    SyntaxError: invalid syntax


It seems the expansion of variables is not working inside the
do_package_prepend task.
What is going wrong with that?

Thank you in advance! :-)

[-- Attachment #2: Type: text/html, Size: 3611 bytes --]

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

* Re: Expansion of variables inside do_package_prepend task
  2018-02-21 15:50 Expansion of variables inside do_package_prepend task Iván Castell
@ 2018-02-21 16:17 ` Joshua Watt
  2018-02-22 16:11   ` Iván Castell
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua Watt @ 2018-02-21 16:17 UTC (permalink / raw)
  To: Iván Castell, Yocto Project

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On Wed, 2018-02-21 at 16:50 +0100, Iván Castell wrote:
> Hello forum.
> 
> I have a question regarding the expansion of variables in a recipe.
> Suppose I have a recipe with this "do_install" task defined:
> 
>     do_install() {
>         BBB = ${WORKDIR}
>     }
> 
> Variable BBB expands to the proper working directory. 
> 
> 
>     $ bitbake -e <myrecipe> | grep BBB
>     BBB = /path/to/working/directory
> 
> 
> However, suppose now I have a recipe with this "do_package_prepend"
> task defined:
> 
>     do_package_prepend() {
>         AAA = ${WORKDIR}
>     }
> 
> Variable AAA doesn't expand to the expected working directory. In
> fact, it generates an error:
> 
> 
>     $ bitbake -e <myrecipe> | grep AAA
>     AAA = ${WORKDIR}
>           ^
>     SyntaxError: invalid syntax

do_package is a python function, so you prepend code must also be
python. You can do:
 AAA = d.getVar('WORKDIR')
> It seems the expansion of variables is not working inside the
> do_package_prepend task. What is going wrong with that?
> 
> Thank you in advance! :-)
> 
> 

[-- Attachment #2: Type: text/html, Size: 4247 bytes --]

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

* Re: Expansion of variables inside do_package_prepend task
  2018-02-21 16:17 ` Joshua Watt
@ 2018-02-22 16:11   ` Iván Castell
  0 siblings, 0 replies; 3+ messages in thread
From: Iván Castell @ 2018-02-22 16:11 UTC (permalink / raw)
  To: Joshua Watt; +Cc: Yocto Project

[-- Attachment #1: Type: text/plain, Size: 1508 bytes --]

2018-02-21 17:17 GMT+01:00 Joshua Watt <jpewhacker@gmail.com>:

> On Wed, 2018-02-21 at 16:50 +0100, Iván Castell wrote:
>
> Hello forum.
>
> I have a question regarding the expansion of variables in a recipe.
> Suppose I have a recipe with this "do_install" task defined:
>
>     do_install() {
>         BBB = ${WORKDIR}
>     }
>
> Variable BBB expands to the proper working directory.
>
>     $ bitbake -e <myrecipe> | grep BBB
>     BBB = /path/to/working/directory
>
>
> However, suppose now I have a recipe with this "do_package_prepend" task
> defined:
>
>     do_package_prepend() {
>         AAA = ${WORKDIR}
>     }
>
> Variable AAA doesn't expand to the expected working directory. In fact, it
> generates an error:
>
>     $ bitbake -e <myrecipe> | grep AAA
>     AAA = ${WORKDIR}
>           ^
>     SyntaxError: invalid syntax
>
>
> do_package is a python function, so you prepend code must also be python.
> You can do:
>
> AAA = d.getVar('WORKDIR')
>
>

Im sorry for asking an obvious question, but documentation is not very
clear. I wrongly assumed that each recipe was executed by the same
interpreter, and seems I was wrong. Then each task is executed by a
different interpreter. This has sense... Thank you very much for the
clarification and for your time! :-)



>
>
> It seems the expansion of variables is not working inside the
> do_package_prepend task.
> What is going wrong with that?
>
> Thank you in advance! :-)
>
>

[-- Attachment #2: Type: text/html, Size: 5530 bytes --]

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

end of thread, other threads:[~2018-02-22 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-21 15:50 Expansion of variables inside do_package_prepend task Iván Castell
2018-02-21 16:17 ` Joshua Watt
2018-02-22 16:11   ` Iván Castell

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.