summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-02-07 09:08:49 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-07 14:36:01 +0000
commitd01b4bd15b94aca8344dd32517d7a4153637b025 (patch)
tree89642fd4ead1895a9ccff3cc56e90d706f6dc276 /bitbake/lib
parent03b1180825df3e6b7595e7cab6531d0c02998430 (diff)
downloadpoky-d01b4bd15b94aca8344dd32517d7a4153637b025.tar.gz
bitbake: lib/bb/build: add tasksbetween() function
Add a utility function that gives the list of dependent tasks between two specified tasks (just within the same recipe). This is intended to be able to be executed from recipe context so it uses the datastore rather than having access to the runqueue. This will be used in OpenEmbedded-Core's populate_sdk_ext.bbclass to get the list of tasks between do_image_complete and do_build. (Bitbake rev: 433379bf12cf31fdf46defdf66695cf8be9994b1) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/build.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index c08ef8904d..0d0100a064 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -878,3 +878,30 @@ def preceedtask(task, with_recrdeptasks, d):
878 if recrdeptask: 878 if recrdeptask:
879 preceed.update(recrdeptask.split()) 879 preceed.update(recrdeptask.split())
880 return preceed 880 return preceed
881
882def tasksbetween(task_start, task_end, d):
883 """
884 Return the list of tasks between two tasks in the current recipe,
885 where task_start is to start at and task_end is the task to end at
886 (and task_end has a dependency chain back to task_start).
887 """
888 outtasks = []
889 tasks = list(filter(lambda k: d.getVarFlag(k, "task"), d.keys()))
890 def follow_chain(task, endtask, chain=None):
891 if not chain:
892 chain = []
893 chain.append(task)
894 for othertask in tasks:
895 if othertask == task:
896 continue
897 if task == endtask:
898 for ctask in chain:
899 if ctask not in outtasks:
900 outtasks.append(ctask)
901 else:
902 deps = d.getVarFlag(othertask, 'deps', False)
903 if task in deps:
904 follow_chain(othertask, endtask, chain)
905 chain.pop()
906 follow_chain(task_start, task_end)
907 return outtasks