addtask between do_populate_sysroot and do_package breaks the build if recipe adds a user via useradd class. ``` inherit useradd USERADD_PACKAGES = "${PN}" USERADD_PARAM_${PN} = "--system --home-dir /var/lib/foo -g foo --shell /bin/false foo" GROUPADD_PARAM_${PN} = "--system foo" do_something() { : } addtask something after do_populate_sysroot before do_package ``` results in following: ``` Exception: FileExistsError: [Errno 17] File exists: '<build-folder>/tmp/sysroots-components/x86-64-generic/<recipe-name>/usr/bin/postinst-useradd-foo' -> '<build-folder>/tmp/work/x86-64-generic-mbient-linux/<recipe-name>/<PN>/recipe-sysroot/usr/bin/postinst-useradd-foo' ```
Hello, In my opinion, it does not make sense to add a task between do_populate_sysroot and do_package which are unrelated. Doing so creates a indirect dependency from do_package to do_populate_sysroot. That means we are populating a recipe with itself, which is probably useless. The chain of tasks at that point is : do_install --- do_package \ \--- do_populate_sysroot do_package is used to create the package while do_populate_sysroot is used for recipes that depends on that one. The issue is raised because of that creates an extra call to `extend_recipe_sysroot` (which was already called in do_prepare_recipe_sysroot): ``` python staging_taskhandler() { bbtasks = e.tasklist for task in bbtasks: deps = d.getVarFlag(task, "depends") if task != 'do_prepare_recipe_sysroot' and (task == "do_configure" or (deps and "populate_sysroot" in deps)): d.prependVarFlag(task, "prefuncs", "extend_recipe_sysroot ") } ``` To avoid the error, we can check in this python code that `deps` is not the task itself. Still, I agree the log does not help. It does not give a good logging because it does not make circular dependencies. Perhaps we should forbid to create relations between those two tasks ?
Hallo, Thanks for your comment. Having more insight into yocto design, I'd agree that there should be no dependency between do_package and do_populate_sysroot, and agree even more that a meaningful error message on such dependency introduction is required.
Testcase added: https://git.yoctoproject.org/poky/commit/?id=e3ce7ce2158cff3c4f4f27166fac125d3f664bde Bug fixed and test enabled: https://git.yoctoproject.org/poky/commit/?id=4bb222e0d71a4cb159b8a4f1a90b65b1af32ac10