summaryrefslogtreecommitdiff
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:35:12 +0000
commit433379bf12cf31fdf46defdf66695cf8be9994b1 (patch)
tree058a1aad36d9433bb690d25a345891eb4e4cb694
parent2a309cd20cddf3d2258bd00ad06b26452e6cc043 (diff)
downloadbitbake-contrib-433379bf12cf31fdf46defdf66695cf8be9994b1.zip
bitbake-contrib-433379bf12cf31fdf46defdf66695cf8be9994b1.tar.gz
bitbake-contrib-433379bf12cf31fdf46defdf66695cf8be9994b1.tar.bz2
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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/build.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py
index c08ef89..0d0100a 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -878,3 +878,30 @@ def preceedtask(task, with_recrdeptasks, d):
if recrdeptask:
preceed.update(recrdeptask.split())
return preceed
+
+def tasksbetween(task_start, task_end, d):
+ """
+ Return the list of tasks between two tasks in the current recipe,
+ where task_start is to start at and task_end is the task to end at
+ (and task_end has a dependency chain back to task_start).
+ """
+ outtasks = []
+ tasks = list(filter(lambda k: d.getVarFlag(k, "task"), d.keys()))
+ def follow_chain(task, endtask, chain=None):
+ if not chain:
+ chain = []
+ chain.append(task)
+ for othertask in tasks:
+ if othertask == task:
+ continue
+ if task == endtask:
+ for ctask in chain:
+ if ctask not in outtasks:
+ outtasks.append(ctask)
+ else:
+ deps = d.getVarFlag(othertask, 'deps', False)
+ if task in deps:
+ follow_chain(othertask, endtask, chain)
+ chain.pop()
+ follow_chain(task_start, task_end)
+ return outtasks