[yocto] how to add a task via anonymous python function
Joshua Immanuel
josh at hipro.co.in
Fri Nov 2 07:42:29 PDT 2012
Hello,
On Thu, 2012-11-01 at 13:16 +0530, Joshua Immanuel wrote:
> I want to do the following in anonymous python function
>
> addtask some_task after do_compile before do_install
>
> Getting some clue from externalsrc.bbclass I did the following
>
> python __anonymous () {
> tasks = d.getVar('__BBTASKS')
> tasks.insert(tasks.index('do_install'), 'do_some_task')
> d.setVar('__BBTASKS', tasks)
> d.setVarFlag('do_some_task', 'deps', 'do_compile')
> d.setVarFlag('do_install', 'deps', 'do_some_task')
> tasklist = filter(lambda k: d.getVarFlag(k, "task"),
> d.keys())
> print tasklist
> }
>
> The above printed tasklist doesn't contain 'do_some_task'.
If we have a recipe which has the BBCLASSEXTEND = "native" set and if we
want to add a task just for the <recipe>-native alone. I thought, I
could check the ${PN} and add the task dynamically. Since the above
method is flawed. I followed a simpler and straight forward approach
without tweaking the bitbake's internal variable. (Hope this helps
someone)
BBCLASSEXTEND = "native"
addtask some_task after do_compile before do_install
python __anonymous () {
pn = d.getVar('PN', True)
if not pn.endswith("native"):
d.setVarFlag('do_some_task', 'noexec', '1')
}
--
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20121102/8d908497/attachment.pgp>
More information about the yocto
mailing list