Skip to contentSkip to conversation

bb.build: delete tasks thoroughly

PATCH In review Christopher Larson 2 participants 3 messages Aug 3, 2015 – Aug 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bb.build: delete tasks thoroughly

From: Christopher Larson <[email protected]>

We want addtask to be able to bring back a deleted task, but we don't want its previous dependencies to come back with it, so rather than marking a task as deleted and then skipping tasks marked as such, actually delete the task and its dependency information in deltask.

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

---
 lib/bb/build.py     | 23 +++++++++++++----------
 lib/bb/parse/ast.py |  3 +--
 2 files changed, 14 insertions(+), 12 deletions(-)
lib/bb/build.py +13 -10
index 764163f..948c395 100644
@@ -686,7 +686,7 @@ def stampfile(taskname, d, file_name = None):
     """
     return stamp_internal(taskname, d, file_name)
 
-def add_tasks(tasklist, deltasklist, d):
+def add_tasks(tasklist, d):
     task_deps = d.getVar('_task_deps', False)
     if not task_deps:
         task_deps = {}
@@ -698,9 +698,6 @@ def add_tasks(tasklist, deltasklist, d):
     for task in tasklist:
         task = d.expand(task)
 
-        if task in deltasklist:
-            continue
-
         d.setVarFlag(task, 'task', 1)
 
         if not task in task_deps['tasks']:
@@ -738,7 +735,7 @@ def addtask(task, before, after, d):
 
     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)
 
@@ -760,8 +757,14 @@ def deltask(task, d):
     if task[:3] != "do_":
         task = "do_" + task
 
-    bbtasks = d.getVar('__BBDELTASKS', False) or []
-    if not task in bbtasks:
-        bbtasks.append(task)
-    d.setVar('__BBDELTASKS', bbtasks)
-
+    bbtasks = d.getVar('__BBTASKS', False) or []
+    if task in bbtasks:
+        bbtasks.remove(task)
+        d.setVar('__BBTASKS', bbtasks)
+
+    d.delVarFlag(task, 'deps')
+    for bbtask in d.getVar('__BBTASKS', False) or []:
+        deps = d.getVarFlag(bbtask, 'deps') or []
+        if task in deps:
+            deps.remove(task)
+            d.setVarFlag(bbtask, 'deps', deps)
lib/bb/parse/ast.py +1 -2
index bd42bd3..11db180 100644
@@ -330,8 +330,7 @@ def finalize(fn, d, variant = None):
     bb.data.update_data(d)
 
     tasklist = d.getVar('__BBTASKS', False) or []
-    deltasklist = d.getVar('__BBDELTASKS', False) or []
-    bb.build.add_tasks(tasklist, deltasklist, d)
+    bb.build.add_tasks(tasklist, d)
 
     bb.parse.siggen.finalise(fn, d, variant)
 
Signature · 1 line
2.2.1
#1 lore raw
Quoted 10 lines · Christopher Larson

From: Christopher Larson <[email protected]>

We want addtask to be able to bring back a deleted task, but we don't want its
previous dependencies to come back with it, so rather than marking a task as
deleted and then skipping tasks marked as such, actually delete the task and
its dependency information in deltask.

Quoted 5 lines

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

This supercedes [PATCH] bb.build: let addtask undo a deltask.

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

On Mon, Aug 3, 2015 at 12:21 PM, Christopher Larson <[email protected]

Quoted 15 lines

wrote:

Quoted 10 lines · Christopher Larson

From: Christopher Larson <[email protected]>

We want addtask to be able to bring back a deleted task, but we don't want its
previous dependencies to come back with it, so rather than marking a task as
deleted and then skipping tasks marked as such, actually delete the task and
its dependency information in deltask.

Quoted 8 lines
Quoted 5 lines

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

This supercedes [PATCH] bb.build: let addtask undo a deltask.

Ping :)

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