[oe-commits] Richard Purdie : nativesdk.bbclass: Correct ordering of manipulations

git version control git at git.openembedded.org
Tue Jun 14 12:09:58 UTC 2011


Module: openembedded-core.git
Branch: master
Commit: c3d317014f417ca895458b797afdf6c40e5b5a57
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=c3d317014f417ca895458b797afdf6c40e5b5a57

Author: Richard Purdie <richard.purdie at linuxfoundation.org>
Date:   Mon Jun 13 14:36:12 2011 +0100

nativesdk.bbclass: Correct ordering of manipulations

OVERDIDES is the key variable that needs to be set prior to data finalisation.
The other variables should be manipulated after finalisation so any
DEPENDS_prepend and _append are accounted for. This patch ensures this is
the case.

The PACKAGES maniupulations are not enabled at this time as they
don't function 100% correctly yet.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/nativesdk.bbclass |   53 ++++++++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass
index 644e731..3fe4bf9 100644
--- a/meta/classes/nativesdk.bbclass
+++ b/meta/classes/nativesdk.bbclass
@@ -62,27 +62,48 @@ python nativesdk_virtclass_handler () {
     if not pn.endswith("-nativesdk"):
         return
 
-    depends = bb.data.getVar("DEPENDS", e.data, True)
-    deps = bb.utils.explode_deps(depends)
-    newdeps = []
-    for dep in deps:
-        if dep.endswith("-native") or dep.endswith("-cross"):
-            newdeps.append(dep)
-        elif dep.endswith("-gcc-intermediate") or dep.endswith("-gcc-initial") or dep.endswith("-gcc") or dep.endswith("-g++"):
-            newdeps.append(dep + "-crosssdk")
-        elif not dep.endswith("-nativesdk"):
-            newdeps.append(dep + "-nativesdk")
-        else:
-            newdeps.append(dep)
-    bb.data.setVar("DEPENDS", " ".join(newdeps), e.data)
-    provides = bb.data.getVar("PROVIDES", e.data, True)
+    bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", e.data, False) + ":virtclass-nativesdk", e.data)
+}
+
+python () {
+    pn = bb.data.getVar("PN", d, True)
+    if not pn.endswith("-nativesdk"):
+        return
+
+    def map_dependencies(varname, d, suffix = ""):
+        if suffix:
+            varname = varname + "_" + suffix
+        deps = bb.data.getVar(varname, d, True)
+        if not deps:
+            return
+        deps = bb.utils.explode_deps(deps)
+        newdeps = []
+        for dep in deps:
+            if dep.endswith("-native") or dep.endswith("-cross"):
+                newdeps.append(dep)
+            elif dep.endswith("-gcc-intermediate") or dep.endswith("-gcc-initial") or dep.endswith("-gcc") or dep.endswith("-g++"):
+                newdeps.append(dep + "-crosssdk")
+            elif not dep.endswith("-nativesdk"):
+                newdeps.append(dep.replace("-nativesdk", "") + "-nativesdk")
+            else:
+                newdeps.append(dep)
+        bb.data.setVar(varname, " ".join(newdeps), d)
+
+    map_dependencies("DEPENDS", d)
+    #for pkg in (d.getVar("PACKAGES", True).split() + [""]):
+    #    map_dependencies("RDEPENDS", d, pkg)
+    #    map_dependencies("RRECOMMENDS", d, pkg)
+    #    map_dependencies("RSUGGESTS", d, pkg)
+    #    map_dependencies("RPROVIDES", d, pkg)
+    #    map_dependencies("RREPLACES", d, pkg)
+
+    provides = bb.data.getVar("PROVIDES", d, True)
     for prov in provides.split():
         if prov.find(pn) != -1:
             continue
         if not prov.endswith("-nativesdk"):
             provides = provides.replace(prov, prov + "-nativesdk")
-    bb.data.setVar("PROVIDES", provides, e.data)
-    bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", e.data, False) + ":virtclass-nativesdk", e.data)
+    bb.data.setVar("PROVIDES", provides, d)
 }
 
 addhandler nativesdk_virtclass_handler





More information about the Openembedded-commits mailing list