[OE-core] can i use bitbake to run an arbitrary python routine in a class file?
Robert P. J. Day
rpjday at crashcourse.ca
Mon Jul 2 16:57:39 UTC 2012
On Mon, 2 Jul 2012, Chris Larson wrote:
> On Mon, Jul 2, 2012 at 6:40 AM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
> > i'm not even remotely a python expert (working on that, though) so
> > there may be a trivial and documented answer to this -- can i use
> > bitbake to run an arbitrary python routine to see what the output
> > would be?
> >
> > for example, here's qemu.bbclass:
> >
> > def qemu_target_binary(data):
> > import bb
> >
> > target_arch = data.getVar("TARGET_ARCH", True)
> > if target_arch in ("i486", "i586", "i686"):
> > target_arch = "i386"
> > elif target_arch == "powerpc":
> > target_arch = "ppc"
> >
> > return "qemu-" + target_arch
> >
> > what if i wanted to see what that would return given a current build?
> > can i do that? does that question even make sense?
... snip ...
> Alternatively, just do:
>
> FOO = "${@qemu_target_binary(d)}"
>
> And then: bitbake -e | grep \^FOO=
i tried this with a "qemux86" MACHINE selection and got:
# expansion of FOO threw ExpansionError: Failure expanding variable
FOO, expression was ${@qemu_target_binary(d)} which triggered
exception NameError: name 'qemu_target_binary' is not defined
that seemed a bit weird since i was just assuming a qemu-based build
would automatically inherit that class file. so i added:
INHERIT += "qemu"
to my local.conf and that fixed it. i was a bit surprised that that
class file wasn't part of a qemu build. the only class file that
inherits it:
meta/classes/libc-package.bbclass:inherit qemu
i'm just surprised i picked what looked like a good test case, and
it turned out to not work the way i thought.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
More information about the Openembedded-core
mailing list