[bitbake-devel] python function used in variable expansion called multiple times per recipe

Daniel Lazzari dlazzari at leapfrog.com
Wed Apr 18 23:39:11 UTC 2012


I think immediate expansion is what I’ll need to use, thanks for the tip. That at least brings the invocation down to once per run. Unfortunately, the variable doesn’t seem to get filled in when I change to immediate expansion.

def testFunc(bb, d):
                print( bb.data.getVar("PN", d, True) )
                return "e1"

EXTERNPV := "${@testFunc(bb, d)}"

Now only prints the package name once, but using –e, I don’t see the variable EXTERNPV at all.

From: Christopher Larson [mailto:kergoth at gmail.com]
Sent: Wednesday, April 18, 2012 4:07 PM
To: Daniel Lazzari
Cc: 'bitbake-devel at lists.openembedded.org' (bitbake-devel at lists.openembedded.org)
Subject: Re: [bitbake-devel] python function used in variable expansion called multiple times per recipe

${@} contents are evaluated when the variable is expanded. Variables are expanded when they're used, much in the way they are in makefiles. Use := to force immediate expansion, or don't use ${@} (alternatives, anonymous python function or event handler).

--
Christopher Larson


On Wednesday, April 18, 2012 at 2:21 PM, Daniel Lazzari wrote:
Hi everyone,

I've been wrestling with this problem for over a day now so I figured it's time to call in the cavalry.
I have a class in our layer that needs to fill in a variable (EXTERNPV) with information about svn externals in a project. This process can be very time consuming and resource intensive so I would prefer that it only happen once per run. Unfortunately, it seems to run 5 times for each recipe that inherits the class. You can easily duplicate the behavior I see with the following:

def testFunc(bb, d):
print( bb.data.getVar("PN", d, True) )
return "e1"

EXTERNPV = "${@testFunc(bb, d)}"

Am I doing something wrong? Is there some assignment operator I can use to ensure this only has to be done once? Or maybe a variable flag?

As always, I very much appreciate the help.

Dan Lazzari Jr.
Firmware Engineer
dlazzari at leapfrog.com<mailto:dlazzari at leapfrog.com>


_______________________________________________
bitbake-devel mailing list
bitbake-devel at lists.openembedded.org<mailto:bitbake-devel at lists.openembedded.org>
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20120418/65c193b5/attachment.html>


More information about the bitbake-devel mailing list