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

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to