summaryrefslogtreecommitdiffstats
path: root/meta/classes/native.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-09 17:56:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-09 22:49:10 +0100
commit1b53eef2769d1b5e4ff527ccabf9b700afc02220 (patch)
treeeac0ab929bf93d34cb48b1be690d9a19a37330b7 /meta/classes/native.bbclass
parent69c87c5ebba27d843e00a01d02031477f23867fe (diff)
downloadpoky-1b53eef2769d1b5e4ff527ccabf9b700afc02220.tar.gz
native/nativesdk: Clean up the depends ordering after bitbake override handling updates
This massively cleans up the dependency handling in the two classes when interacting with BBCLASSEXTEND. This change has a dependency on the bitbake override handling change and also the existence of the RecipePreFinalise event. (From OE-Core rev: f183c7cfe377fa6ed2777605c3590a9dda2060df) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/native.bbclass')
-rw-r--r--meta/classes/native.bbclass72
1 files changed, 40 insertions, 32 deletions
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
index 1b510f6c90..90fcd131c6 100644
--- a/meta/classes/native.bbclass
+++ b/meta/classes/native.bbclass
@@ -85,17 +85,25 @@ EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
85PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" 85PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
86PKG_CONFIG_SYSROOT_DIR = "" 86PKG_CONFIG_SYSROOT_DIR = ""
87 87
88ORIG_DEPENDS := "${DEPENDS}" 88python native_virtclass_handler () {
89ORIG_RDEPENDS := "${RDEPENDS}" 89 if not isinstance(e, bb.event.RecipePreFinalise):
90 90 return
91DEPENDS_virtclass-native ?= "${ORIG_DEPENDS}" 91
92RDEPENDS_virtclass-native ?= "${ORIG_RDEPENDS}" 92 classextend = bb.data.getVar('BBCLASSEXTEND', e.data, True) or ""
93 93 if "native" not in classextend:
94python __anonymous () { 94 return
95 if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""): 95
96 pn = bb.data.getVar("PN", d, True) 96 pn = bb.data.getVar("PN", e.data, True)
97 depends = bb.data.getVar("DEPENDS_virtclass-native", d, True) 97 if not pn.endswith("-native"):
98 deps = bb.utils.explode_deps(depends) 98 return
99
100 def map_dependencies(varname, d, suffix = ""):
101 if suffix:
102 varname = varname + "_" + suffix
103 deps = bb.data.getVar(varname, d, True)
104 if not deps:
105 return
106 deps = bb.utils.explode_deps(deps)
99 newdeps = [] 107 newdeps = []
100 for dep in deps: 108 for dep in deps:
101 if dep.endswith("-cross"): 109 if dep.endswith("-cross"):
@@ -104,29 +112,29 @@ python __anonymous () {
104 newdeps.append(dep + "-native") 112 newdeps.append(dep + "-native")
105 else: 113 else:
106 newdeps.append(dep) 114 newdeps.append(dep)
107 bb.data.setVar("DEPENDS_virtclass-native", " ".join(newdeps), d) 115 bb.data.setVar(varname, " ".join(newdeps), d)
108 rdepends = bb.data.getVar("RDEPENDS_virtclass-native", d, True) 116
109 rdeps = bb.utils.explode_deps(rdepends) 117 map_dependencies("DEPENDS", e.data)
110 newdeps = [] 118 for pkg in (e.data.getVar("PACKAGES", True).split() + [""]):
111 for dep in rdeps: 119 map_dependencies("RDEPENDS", e.data, pkg)
112 if dep.endswith("-cross"): 120 map_dependencies("RRECOMMENDS", e.data, pkg)
113 newdeps.append(dep.replace("-cross", "-native")) 121 map_dependencies("RSUGGESTS", e.data, pkg)
114 elif not dep.endswith("-native"): 122 map_dependencies("RPROVIDES", e.data, pkg)
115 newdeps.append(dep + "-native") 123 map_dependencies("RREPLACES", e.data, pkg)
116 else: 124
117 newdeps.append(dep) 125 provides = bb.data.getVar("PROVIDES", e.data, True)
118 bb.data.setVar("RDEPENDS_virtclass-native", " ".join(newdeps), d) 126 for prov in provides.split():
119 provides = bb.data.getVar("PROVIDES", d, True) 127 if prov.find(pn) != -1:
120 for prov in provides.split(): 128 continue
121 if prov.find(pn) != -1: 129 if not prov.endswith("-native"):
122 continue 130 provides = provides.replace(prov, prov + "-native")
123 if not prov.endswith("-native"): 131 bb.data.setVar("PROVIDES", provides, e.data)
124 132
125 provides = provides.replace(prov, prov + "-native") 133 bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", e.data, False) + ":virtclass-native", e.data)
126 bb.data.setVar("PROVIDES", provides, d)
127 bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-native", d)
128} 134}
129 135
136addhandler native_virtclass_handler
137
130do_package[noexec] = "1" 138do_package[noexec] = "1"
131do_package_write_ipk[noexec] = "1" 139do_package_write_ipk[noexec] = "1"
132do_package_write_deb[noexec] = "1" 140do_package_write_deb[noexec] = "1"