[yocto] Using anonymous python function to define variables

Ulf Winberg ulfwin at gmail.com
Sun Dec 7 03:22:06 PST 2014


I'm struggling with trying to dynamically set a file name, to be used with
"require". See code below:

python () {
       TA = d.getVar('TARGET_ARCH', True)
       if TA == "arm":
               javaPkg = "oracle-jse-ejre-arm-vfp-hflt-client-headless"
       elif TA == "i586":
               javaPkg = "oracle-jse-jre-i586"
       elif TA == "x86_64":
               javaPkg = "oracle-jse-jre-x86-64"
       else:
               raise Exception("Target architecture '%s' is not supported
by the meta-oracle-java layer" %TA)
       d.setVar('JAVA_PKG', javaPkg)
}

require ${JAVA_PKG}.inc

The python function executes properly (if I print javaPkg, it shows up
correctly) but the "JAVA_PKG" variable does not become available for
"require". From what I can read in section 3.4.4 in this link
<http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html>,
it seems to me it should work. Could someone please explain to me why it
doesn't?

Thank you in advance!

Ulf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20141207/f5f429c8/attachment.html>


More information about the yocto mailing list