Bug 10256 - execute empty tasks?
Summary: execute empty tasks?
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-09-12 07:01 UTC by Patrick Ohly
Modified: 2016-09-15 12:49 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Ohly 2016-09-12 07:01:50 UTC
Tasks can have side effects besides executing their content. For example, recently do_rootfs was changed so that it creates ${IMGDEPLOYDIR}, the directory which all following image-related tasks write into:

do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"

meta-swupd has a special image creation mode where do_rootfs is set to empty with e.data.setVar("do_rootfs", "") in a virtual recipe and the final rootfs gets created in do_image.

Setting do_rootfs to empty had the effect that it was skipped *completely*, including the creation of ${IMGDEPLOYDIR}, which broke creating of such images. 

This might be intentional, but at first glance it looks like a somewhat too eager optimization: IMHO an empty task with side effects is valid and those side effects should be applied.

There's a patch for meta-swupd which works around that (by setting do_rootfs to "pass" instead of ""), so fixing this is not urgent. Closing as "works-as-intended" would also be okay.
Comment 1 Richard Purdie 2016-09-12 11:55:28 UTC
This can be explained if you look at http://git.yoctoproject.org/cgit.cgi/poky/tree/bitbake/lib/bb/build.py#n188 which is the start of the exec_func() which does:

   body = d.getVar(func, False)
    if not body:
        if body is None:
            logger.warning("Function %s doesn't exist", func)
        return


I suspect this could be moved after the directory handling pieces to avoid the effect you describe.