[bitbake-devel] [PATCH 2/2] bitbake: build.py: check dependendent task for addtask

Jacob Kroon jacob.kroon at gmail.com
Wed May 1 10:50:53 UTC 2019


Hi,

On Fri, Apr 26, 2019 at 4:49 AM Robert Yang <liezhi.yang at windriver.com> wrote:
>
>
>
> On 4/25/19 6:50 PM, Richard Purdie wrote:
> > On Thu, 2019-04-25 at 18:01 +0800, Robert Yang wrote:
> >> The following command is incorrect, but was ignored silently, that may suprise
> >> users:
> >>
> >> addtask task after task_not_existed
> >>
> >> This patch can check and warn for it. It would be better to also check "before"
> >> tasks, but there is no easier way to do it.
> >>
> >> [YOCTO #13282]
> >>
> >> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
> >> ---
> >>   bitbake/lib/bb/build.py | 3 +++
> >>   1 file changed, 3 insertions(+)
> >>
> >> diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
> >> index 7571421..861e9a9 100644
> >> --- a/bitbake/lib/bb/build.py
> >> +++ b/bitbake/lib/bb/build.py
> >> @@ -815,6 +815,9 @@ def add_tasks(tasklist, d):
> >>           task_deps['parents'][task] = []
> >>           if 'deps' in flags:
> >>               for dep in flags['deps']:
> >> +                # Check and warn for "addtask task after foo" while foo does not exist
> >> +                if not dep in tasklist:
> >> +                    bb.warn('%s: dependent task %s does not exist!' % (d.getVar('PN'), dep))
> >>                   dep = d.expand(dep)
> >>                   task_deps['parents'][task].append(dep)
> >
> > I can't help wonder if this change has races, depending on the order of
> > the addtask and deltask expressions. Do most layers parse cleanly with
> > this?
>
> The bb.build.add_tasks() is only called by ast.py's finalize(), I think that
> everything should be ready in finalize stage, and there should be no races.
> I tested this with meta-oe, python perl, selinux and others, didn't see
> any problems (unless I depended on an invalid task).
>
> >
> > At one point bitbake did support "floating" invalid tasks, I can't
> > remember if we changed that or not though.
>
> This warning is good for checking typos during development, I think that
> user can call "bb.build.addtask()" dynamically in a function to fix the warning
> for floating tasks?
>

I'm getting a lot of these warnings after removing tmp/ and rebuilding
my image from sstate cache.
FWIW I use rm_work.bbclass, and regularly use the
sstate-cache-management,sh script to prune old cache.

/Jacob


More information about the bitbake-devel mailing list