nativesdk: Convert to use classextend.py

This patch converts the nativesdk class itself from operating as a suffix
to a prefix (see the proceeding patch for the related changes outside this
class).

The big benefit here is that we can reuse the generic class extension code.

(From OE-Core rev: f01f0b8aed25af889f48fe1afff96feb3d9ed120)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2011-12-21 13:53:11 +00:00
parent 9ba1e33e2d
commit 58a8a38aa2
2 changed files with 15 additions and 34 deletions

View File

@ -59,51 +59,28 @@ python nativesdk_virtclass_handler () {
return
pn = e.data.getVar("PN", True)
if not pn.endswith("-nativesdk"):
if not pn.endswith("-nativesdk") or pn.startswith("nativesdk-"):
return
e.data.setVar("MLPREFIX", "nativesdk-")
e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN", True).replace("-nativesdk", "").replace("nativesdk-", ""))
e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-nativesdk")
}
python () {
pn = d.getVar("PN", True)
if not pn.endswith("-nativesdk"):
if not pn.startswith("nativesdk-"):
return
def map_dependencies(varname, d, suffix = ""):
if suffix:
varname = varname + "_" + suffix
deps = d.getVar(varname, 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)
d.setVar(varname, " ".join(newdeps))
import oe.classextend
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)
clsextend = oe.classextend.NativesdkClassExtender("nativesdk", d)
clsextend.rename_packages()
clsextend.rename_package_variables((d.getVar("PACKAGEVARS", True) or "").split())
provides = d.getVar("PROVIDES", True)
for prov in provides.split():
if prov.find(pn) != -1:
continue
if not prov.endswith("-nativesdk"):
provides = provides.replace(prov, prov + "-nativesdk")
d.setVar("PROVIDES", provides)
clsextend.map_depends_variable("DEPENDS")
clsextend.map_packagevars()
clsextend.map_variable("PROVIDES")
}
addhandler nativesdk_virtclass_handler

View File

@ -7,6 +7,10 @@ class ClassExtender(object):
def extend_name(self, name):
if name.startswith("kernel-module"):
return name
if name.startswith("rtld"):
return name
if name.endswith("-" + self.extname):
name = name.replace("-" + self.extname, "")
if name.startswith("virtual/"):
subs = name.split("/", 1)[1]
if not subs.startswith(self.extname):