Search code examples
pythonshellmingwyoctobitbake

Yocto: _append python code to a shell task


I want to append a non-trivial python code to the "do_install" task, which is shell code.

How can I do that? Can I just use the following, and it magically will work?

python do_install_append() {

}

What's the best workaround? Use the [postfuncs] attribute? Or create an entirely new task and add it after do_install before do_package?

Goal:

I'm porting some packages to be able to build for MACHINE=x86-64_mingw32. Some packages install their .dll files into ${libdir}, but for MinGW the correct folder for shared libraries would be ${bindir} (according to other build systems like MSYS2 and MXE), so my class will automatically move entire sub-trees out of ${libdir} into ${bindir}, after the recipe's do_install. Afterwards, if this leaves any empty folders in ${libdir} where the shared libraries used to be in, they will be removed.


Solution

  • An append won't magically work, postfuncs would be the best way to handle it. That said, could you set libdir to point at bindir using an override within the recipe?:

    libdir_x86-64-mingw32 = "${bindir}"
    

    That might work better...