how to add a task via anonymous python function
Hello,
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'. I am able to run the task manually via
bitbake -c some_task <recipe_name>
But, the task doesn't gets executed automatically after the do_compile task. Is there anything else that should be done?
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Hello,
Quoted 17 lines · Joshua Immanuel
I want to do the following in anonymous python function
addtask
some_taskafterdo_compilebeforedo_installGetting 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 }
Quoted 1 line
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')
}Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in