Patchwork [bitbake-devel] runqueue.py: Allow recrdeptasks that have self references

login
register
mail settings
Submitter Richard Purdie
Date July 2, 2012, 12:29 p.m.
Message ID <1341232193.23146.225.camel@ted>
Download mbox | patch
Permalink /patch/30979/
State New
Headers show

Comments

Richard Purdie - July 2, 2012, 12:29 p.m.
In some cases we want to pull in DEPENDS and RDEPENDS of recrdeptask
dependencies but we need a way to trigger or avoid this behaviour
depending on context. The logical syntax to trigger such behaviour
would be a self referencing recrdeptask:

do_a[recrdeptask] = "do_a do_b"

The dependency chains already recurse this kind of expression correctly, the
missing piece is to avoid any circular reference errors. Since the dependencies
have already been recursively resolved, simply removing any recrdeptask
references is enough to break the circular references.

This patch therefore removes any circular references using the set

Patch

difference_update() operator. There will be metadata tweaks required to
add any references needed to the extra taskname.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index f457ec2..212d297 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -510,7 +510,7 @@  class RunQueueData:
         # We need to do this separately since we need all of self.runq_depends to be complete before this is processed
         extradeps = {}
         for task in recursivetasks:
-            extradeps[task] = set()
+            extradeps[task] = set(self.runq_depends[task])
             tasknames = recursivetasks[task]
             seendeps = set()
             seenfnid = []
@@ -527,10 +527,15 @@  class RunQueueData:
                             generate_recdeps(n)
             generate_recdeps(task)
 
+        # Remove circular references so that do_a[recrdeptask] = "do_a do_b" can work
+        recursivetaskset = set(recursivetasks.keys())
+        for task in recursivetasks:
+            extradeps[task].difference_update(recursivetaskset)
+
         for task in xrange(len(taskData.tasks_name)):
             # Add in extra dependencies
             if task in extradeps:
-                 self.runq_depends[task].update(extradeps[task])
+                 self.runq_depends[task] = extradeps[task]
             # Remove all self references
             if task in self.runq_depends[task]:
                 logger.debug(2, "Task %s (%s %s) contains self reference! %s", task, taskData.fn_index[taskData.tasks_fnid[task]], taskData.tasks_name[task], self.runq_depends[task])