Skip to contentSkip to conversation

externalsrc: Use deltask API

PATCH In review Richard Purdie 2 participants 3 messages Dec 18, 2013 – Dec 21, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 externalsrc: Use deltask API

Now we have deltask API, stop poking around bitbake internal variables.

---

meta/classes/externalsrc.bbclass +3 -18
index c759289..53c71cb 100644
@@ -26,21 +26,6 @@
 
 SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
 
-def remove_tasks(tasks, deltasks, d):
-    for task in tasks:
-        deps = d.getVarFlag(task, "deps")
-        for preptask in deltasks:
-            if preptask in deps:
-                deps.remove(preptask)
-        d.setVarFlag(task, "deps", deps)
-    # Poking around bitbake internal variables is evil but there appears to be no better way :(
-    tasklist = d.getVar('__BBTASKS') or []
-    for task in deltasks:
-        d.delVarFlag(task, "task")
-        if task in tasklist:
-            tasklist.remove(task)
-    d.setVar('__BBTASKS', tasklist)
-
 python () {
     externalsrc = d.getVar('EXTERNALSRC', True)
     if externalsrc:
@@ -53,16 +38,16 @@ python () {
         d.setVar('SRC_URI', '')
 
         tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys())
-        covered = d.getVar("SRCTREECOVEREDTASKS", True).split()
 
         for task in tasks:
             if task.endswith("_setscene"):
                 # sstate is never going to work for external source trees, disable it
-                covered.append(task)
+                bb.build.deltask(task, d)
             else:
                 # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
                 d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock")
 
-        remove_tasks(tasks, covered, d)
+        for task in covered:
+            bb.build.deltask(task, d)
 }
 
#1 lore raw
Quoted 40 lines · Richard Purdie

Now we have deltask API, stop poking around bitbake internal variables.

---

meta/classes/externalsrc.bbclass +0 -17
index c759289..53c71cb 100644
@@ -26,21 +26,6 @@
 
 SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
 
-def remove_tasks(tasks, deltasks, d):
-    for task in tasks:
-        deps = d.getVarFlag(task, "deps")
-        for preptask in deltasks:
-            if preptask in deps:
-                deps.remove(preptask)
-        d.setVarFlag(task, "deps", deps)
-    # Poking around bitbake internal variables is evil but there appears to be no better way :(
-    tasklist = d.getVar('__BBTASKS') or []
-    for task in deltasks:
-        d.delVarFlag(task, "task")
-        if task in tasklist:
-            tasklist.remove(task)
-    d.setVar('__BBTASKS', tasklist)
-
 python () {
     externalsrc = d.getVar('EXTERNALSRC', True)
     if externalsrc:
@@ -53,16 +38,16 @@ python () {
         d.setVar('SRC_URI', '')
 
         tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys())
-        covered = d.getVar("SRCTREECOVEREDTASKS", True).split()
 
         for task in tasks:
             if task.endswith("_setscene"):
                 # sstate is never going to work for external source trees, disable it
-                covered.append(task)

meta/classes/externalsrc.bbclass python () { · line 53

Quoted 10 lines
meta/classes/externalsrc.bbclass +3 -1
+                bb.build.deltask(task, d)
             else:
                 # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
                 d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock")
 
-        remove_tasks(tasks, covered, d)
+        for task in covered:
+            bb.build.deltask(task, d)
 }
 

I've just updated oe-core whilst trying to test my in-development version of opkg using externalsrc and I'm getting:

*** 0022: for task in covered:
0023: bb.build.deltask(task, d)
0024:
Exception: NameError: global name 'covered' is not defined

I don't really know the code in question well so I don't know whether the solution is to remove that last for loop or to add back in the declaration of 'covered'.

Signature · 4 lines
Paul Barker

Email: [email protected]
http://www.paulbarker.me.uk
#2 lore raw
Quoted 56 lines · Paul Barker
Quoted 40 lines · Richard Purdie

Now we have deltask API, stop poking around bitbake internal variables.

---

meta/classes/externalsrc.bbclass +0 -17
index c759289..53c71cb 100644
@@ -26,21 +26,6 @@
 
 SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
 
-def remove_tasks(tasks, deltasks, d):
-    for task in tasks:
-        deps = d.getVarFlag(task, "deps")
-        for preptask in deltasks:
-            if preptask in deps:
-                deps.remove(preptask)
-        d.setVarFlag(task, "deps", deps)
-    # Poking around bitbake internal variables is evil but there appears to be no better way :(
-    tasklist = d.getVar('__BBTASKS') or []
-    for task in deltasks:
-        d.delVarFlag(task, "task")
-        if task in tasklist:
-            tasklist.remove(task)
-    d.setVar('__BBTASKS', tasklist)
-
 python () {
     externalsrc = d.getVar('EXTERNALSRC', True)
     if externalsrc:
@@ -53,16 +38,16 @@ python () {
         d.setVar('SRC_URI', '')
 
         tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys())
-        covered = d.getVar("SRCTREECOVEREDTASKS", True).split()
 
         for task in tasks:
             if task.endswith("_setscene"):
                 # sstate is never going to work for external source trees, disable it
-                covered.append(task)

meta/classes/externalsrc.bbclass python () { · line 53

Quoted 10 lines
meta/classes/externalsrc.bbclass +3 -1
+                bb.build.deltask(task, d)
             else:
                 # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
                 d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock")
 
-        remove_tasks(tasks, covered, d)
+        for task in covered:
+            bb.build.deltask(task, d)
 }
 

I've just updated oe-core whilst trying to test my in-development version of opkg using externalsrc and I'm getting:

Quoted 8 lines

*** 0022: for task in covered:
0023: bb.build.deltask(task, d)
0024:
Exception: NameError: global name 'covered' is not defined

I don't really know the code in question well so I don't know whether the solution is to remove that last for loop or to add back in the declaration of 'covered'.

Sorry about that, I think I've mixed up some patches. I've pushed something which should fix it.

Cheers,

Richard