Skip to contentSkip to conversation

bb.build: let addtask undo a deltask

PATCH In review Christopher Larson 2 participants 3 messages Jul 31, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bb.build: let addtask undo a deltask

From: Christopher Larson <[email protected]>

While we're in that part of the code, also fix 'not foo in bar' to 'foo not in bar', as is preferred in python.

---
 lib/bb/build.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
lib/bb/build.py +7 -2
index 764163f..866056b 100644
@@ -736,9 +736,14 @@ def addtask(task, before, after, d):
     if task[:3] != "do_":
         task = "do_" + task
 
+    deltasks = d.getVar('__BBDELTASKS', False)
+    if deltasks and task in deltasks:
+        deltasks.remove(task)
+        d.setVar('__BBDELTASKS', deltasks)
+
     d.setVarFlag(task, "task", 1)
     bbtasks = d.getVar('__BBTASKS', False) or []
-    if not task in bbtasks:
+    if task not in bbtasks:
         bbtasks.append(task)
     d.setVar('__BBTASKS', bbtasks)
 
@@ -761,7 +766,7 @@ def deltask(task, d):
         task = "do_" + task
 
     bbtasks = d.getVar('__BBDELTASKS', False) or []
-    if not task in bbtasks:
+    if task not in bbtasks:
         bbtasks.append(task)
     d.setVar('__BBDELTASKS', bbtasks)
 
Signature · 1 line
2.2.1
#1 lore raw
Quoted 8 lines · Christopher Larson

From: Christopher Larson <[email protected]>

While we're in that part of the code, also fix 'not foo in bar' to 'foo not in
bar', as is preferred in python.

Hold off on applying this. While it’s a start, it’s not necessarily ideal either, since it doesn’t reset the intra-recipe inter-task dependencies. Re-adding a deleted task will resurrect it exactly as it was, rather than with new specified dependencies. I’m looking into a more thorough deletion now.

Signature · 5 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 10 lines · Christopher Larson
Quoted 6 lines · Christopher Larson

From: Christopher Larson <[email protected]>

While we're in that part of the code, also fix 'not foo in bar' to 'foo not in
bar', as is preferred in python.

Quoted 9 lines
Quoted 2 lines

Hold off on applying this. While it’s a start, it’s not necessarily ideal either, since it doesn’t reset the intra-recipe inter-task dependencies. Re-adding a deleted task will resurrect it exactly as it was, rather than with new specified dependencies. I’m looking into a more thorough deletion now.

I’m currently testing a version which has deltask delete the task’s deps flag, and iterates over __BBTASKS to delete the task from other task’s deps flags. My up front parse times aren’t changing, so it doesn’t seem to have a great deal of impact on performance, which was my only concern with that. The alternative, if the performance is an issue, would likely be to start maintaining revdep information.

Signature · 5 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics