summaryrefslogtreecommitdiffstats
path: root/meta/classes
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
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')
-rw-r--r--meta/classes/autotools.bbclass2
-rw-r--r--meta/classes/base.bbclass2
-rw-r--r--meta/classes/native.bbclass72
-rw-r--r--meta/classes/nativesdk.bbclass23
4 files changed, 54 insertions, 45 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index 27f4a01f12..98c871acc3 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -21,8 +21,6 @@ def autotools_dep_prepend(d):
21EXTRA_OEMAKE = "" 21EXTRA_OEMAKE = ""
22 22
23DEPENDS_prepend = "${@autotools_dep_prepend(d)}" 23DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
24DEPENDS_virtclass-native_prepend = "${@autotools_dep_prepend(d)}"
25DEPENDS_virtclass-nativesdk_prepend = "${@autotools_dep_prepend(d)}"
26 24
27inherit siteinfo 25inherit siteinfo
28 26
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 26c59abf8e..e740650cfd 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -69,8 +69,6 @@ def base_dep_prepend(d):
69BASEDEPENDS = "${@base_dep_prepend(d)}" 69BASEDEPENDS = "${@base_dep_prepend(d)}"
70 70
71DEPENDS_prepend="${BASEDEPENDS} " 71DEPENDS_prepend="${BASEDEPENDS} "
72DEPENDS_virtclass-native_prepend="${BASEDEPENDS} "
73DEPENDS_virtclass-nativesdk_prepend="${BASEDEPENDS} "
74 72
75FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}" 73FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}"
76# THISDIR only works properly with imediate expansion as it has to run 74# THISDIR only works properly with imediate expansion as it has to run
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"
diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass
index cd34a798ef..644e73121b 100644
--- a/meta/classes/nativesdk.bbclass
+++ b/meta/classes/nativesdk.bbclass
@@ -54,12 +54,15 @@ FILES_${PN}-dbg += "${prefix}/.debug \
54export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig" 54export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
55export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" 55export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
56 56
57ORIG_DEPENDS := "${DEPENDS}" 57python nativesdk_virtclass_handler () {
58DEPENDS_virtclass-nativesdk ?= "${ORIG_DEPENDS}" 58 if not isinstance(e, bb.event.RecipePreFinalise):
59 return
59 60
60python __anonymous () { 61 pn = bb.data.getVar("PN", e.data, True)
61 pn = bb.data.getVar("PN", d, True) 62 if not pn.endswith("-nativesdk"):
62 depends = bb.data.getVar("DEPENDS_virtclass-nativesdk", d, True) 63 return
64
65 depends = bb.data.getVar("DEPENDS", e.data, True)
63 deps = bb.utils.explode_deps(depends) 66 deps = bb.utils.explode_deps(depends)
64 newdeps = [] 67 newdeps = []
65 for dep in deps: 68 for dep in deps:
@@ -71,16 +74,18 @@ python __anonymous () {
71 newdeps.append(dep + "-nativesdk") 74 newdeps.append(dep + "-nativesdk")
72 else: 75 else:
73 newdeps.append(dep) 76 newdeps.append(dep)
74 bb.data.setVar("DEPENDS_virtclass-nativesdk", " ".join(newdeps), d) 77 bb.data.setVar("DEPENDS", " ".join(newdeps), e.data)
75 provides = bb.data.getVar("PROVIDES", d, True) 78 provides = bb.data.getVar("PROVIDES", e.data, True)
76 for prov in provides.split(): 79 for prov in provides.split():
77 if prov.find(pn) != -1: 80 if prov.find(pn) != -1:
78 continue 81 continue
79 if not prov.endswith("-nativesdk"): 82 if not prov.endswith("-nativesdk"):
80 provides = provides.replace(prov, prov + "-nativesdk") 83 provides = provides.replace(prov, prov + "-nativesdk")
81 bb.data.setVar("PROVIDES", provides, d) 84 bb.data.setVar("PROVIDES", provides, e.data)
82 bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-nativesdk", d) 85 bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", e.data, False) + ":virtclass-nativesdk", e.data)
83} 86}
84 87
88addhandler nativesdk_virtclass_handler
89
85do_populate_sysroot[stamp-extra-info] = "" 90do_populate_sysroot[stamp-extra-info] = ""
86do_package[stamp-extra-info] = "" 91do_package[stamp-extra-info] = ""