[OE-core] [PATCH 1/1 RFC - Denzil] nativesdk.bbclass: Fix the remapping code on nativesdk

Mark Hatle mark.hatle at windriver.com
Thu Mar 28 19:40:29 UTC 2013


The following patch is being sent to the oe-core list in order to meet our
Yocto Project compliance requirements.  We don't believe this patch is
generally applicable to Denzil.

The purpose of this change is to fix the way automatic dependencies and such
are generated when creating nativesdk packages.  (This approach was
abandoned in the Danny development and replaced with the multilib approach.)

---

When remapping the nativesdk we need to change the values of
PACKAGES, as well as the various R* items.  But not only the
values, but we need to rename the vars to their new PACKAGES
entries.

In addition, if a package has "-nativesdk" already in the name
we want to add it to RPROVIDES to avoid compatibility problems.

Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
---
 meta/classes/insane.bbclass    |    2 +
 meta/classes/nativesdk.bbclass |   61 +++++++++++++++++++++++++++++++++++----
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 85ccdab..6a80ccf 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -213,6 +213,8 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
     libgcc.a, libgcov.a will be skipped in their packages
     """
 
+    if name.endswith("-nativesdk"):
+        name = name.replace("-nativesdk", "")
     if not name.endswith("-pic") and not name.endswith("-staticdev") and path.endswith(".a") and not path.endswith("_nonshared.a"):
         messages.append("non -staticdev package contains static .a library: %s path '%s'" % \
                  (name, package_qa_clean_path(path,d)))
diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass
index a58fce2..3746190 100644
--- a/meta/classes/nativesdk.bbclass
+++ b/meta/classes/nativesdk.bbclass
@@ -78,7 +78,9 @@ python () {
         deps = bb.utils.explode_deps(deps)
         newdeps = []
         for dep in deps:
-            if dep.endswith("-native") or dep.endswith("-cross"):
+            if dep.startswith("rtld"):
+                newdeps.append(dep)
+            elif 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")
@@ -88,13 +90,58 @@ python () {
                 newdeps.append(dep)
         d.setVar(varname, " ".join(newdeps))
 
+    def renameVars(varname, d, origpkg, newpkg):
+        origV = varname + "_" + origpkg
+        # In the case where FOO_${PN}-bar, we need to figure out the ${PN} and change it to BPN-bar-nativesdk!
+        pnV = varname + "_" + origpkg.replace("-nativesdk", "").replace(d.getVar('PN', True).replace('-nativesdk', ""),d.getVar('PN', True))
+        newV  = varname + "_" + newpkg
+        if origV != newV and not d.getVar(newV, False) and d.getVar(origV, False):
+            d.renameVar(origV, newV)
+        elif pnV != newV and not d.getVar(newV, False) and d.getVar(pnV, False):
+            d.renameVar(pnV, newV)
+
     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)
+    newpkgs = ""
+    for pkg in (d.getVar("PACKAGES", True).split() + [""]):
+        if pkg and not pkg.endswith("-nativesdk"):
+            newpkg = pkg.replace("-nativesdk", "") + "-nativesdk"
+            # If we end up renaming this, we need to add ourselves as a provider
+            if "-nativesdk" in pkg:
+                d.appendVar("RPROVIDES_" + pkg, " " + pkg)
+        else:
+            newpkg = pkg
+        newpkgs += " " + newpkg
+
+        renameVars("FILES", d, pkg, newpkg)
+        renameVars("INSANE_SKIP", d, pkg, newpkg)
+
+        renameVars("ALTERNATIVE", d, pkg, newpkg)
+        renameVars("ALTERNATIVE_TARGET", d, pkg, newpkg)
+        renameVars("ALTERNATIVE_PRIORITY", d, pkg, newpkg)
+
+        renameVars("pkg_postinst", d, pkg, newpkg)
+        renameVars("pkg_postrm", d, pkg, newpkg)
+        renameVars("pkg_preinst", d, pkg, newpkg)
+        renameVars("pkg_prerm", d, pkg, newpkg)
+
+        renameVars("ALLOW_EMPTY", d, pkg, newpkg)
+
+        renameVars("RDEPENDS", d, pkg, newpkg)
+        map_dependencies("RDEPENDS", d, newpkg)
+        renameVars("RRECOMMENDS", d, pkg, newpkg)
+        map_dependencies("RRECOMMENDS", d, newpkg)
+        renameVars("RSUGGESTS", d, pkg, newpkg)
+        map_dependencies("RSUGGESTS", d, newpkg)
+        renameVars("RPROVIDES", d, pkg, newpkg)
+        map_dependencies("RPROVIDES", d, newpkg)
+        renameVars("RREPLACES", d, pkg, newpkg)
+        map_dependencies("RREPLACES", d, newpkg)
+        renameVars("RCONFLICTS", d, pkg, newpkg)
+        map_dependencies("RCONFLICTS", d, newpkg)
+        renameVars("PKG", d, pkg, newpkg)
+        map_dependencies("PKG", d, newpkg)
+
+    d.setVar("PACKAGES", newpkgs)
 
     provides = d.getVar("PROVIDES", True)
     for prov in provides.split():
-- 
1.7.1





More information about the Openembedded-core mailing list