diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-09 17:56:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-09 22:49:10 +0100 |
commit | 1b53eef2769d1b5e4ff527ccabf9b700afc02220 (patch) | |
tree | eac0ab929bf93d34cb48b1be690d9a19a37330b7 /meta/classes | |
parent | 69c87c5ebba27d843e00a01d02031477f23867fe (diff) | |
download | poky-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.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/base.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/native.bbclass | 72 | ||||
-rw-r--r-- | meta/classes/nativesdk.bbclass | 23 |
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): | |||
21 | EXTRA_OEMAKE = "" | 21 | EXTRA_OEMAKE = "" |
22 | 22 | ||
23 | DEPENDS_prepend = "${@autotools_dep_prepend(d)}" | 23 | DEPENDS_prepend = "${@autotools_dep_prepend(d)}" |
24 | DEPENDS_virtclass-native_prepend = "${@autotools_dep_prepend(d)}" | ||
25 | DEPENDS_virtclass-nativesdk_prepend = "${@autotools_dep_prepend(d)}" | ||
26 | 24 | ||
27 | inherit siteinfo | 25 | inherit 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): | |||
69 | BASEDEPENDS = "${@base_dep_prepend(d)}" | 69 | BASEDEPENDS = "${@base_dep_prepend(d)}" |
70 | 70 | ||
71 | DEPENDS_prepend="${BASEDEPENDS} " | 71 | DEPENDS_prepend="${BASEDEPENDS} " |
72 | DEPENDS_virtclass-native_prepend="${BASEDEPENDS} " | ||
73 | DEPENDS_virtclass-nativesdk_prepend="${BASEDEPENDS} " | ||
74 | 72 | ||
75 | FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}" | 73 | FILESPATH = "${@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 ?= "" | |||
85 | PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" | 85 | PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" |
86 | PKG_CONFIG_SYSROOT_DIR = "" | 86 | PKG_CONFIG_SYSROOT_DIR = "" |
87 | 87 | ||
88 | ORIG_DEPENDS := "${DEPENDS}" | 88 | python native_virtclass_handler () { |
89 | ORIG_RDEPENDS := "${RDEPENDS}" | 89 | if not isinstance(e, bb.event.RecipePreFinalise): |
90 | 90 | return | |
91 | DEPENDS_virtclass-native ?= "${ORIG_DEPENDS}" | 91 | |
92 | RDEPENDS_virtclass-native ?= "${ORIG_RDEPENDS}" | 92 | classextend = bb.data.getVar('BBCLASSEXTEND', e.data, True) or "" |
93 | 93 | if "native" not in classextend: | |
94 | python __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 | ||
136 | addhandler native_virtclass_handler | ||
137 | |||
130 | do_package[noexec] = "1" | 138 | do_package[noexec] = "1" |
131 | do_package_write_ipk[noexec] = "1" | 139 | do_package_write_ipk[noexec] = "1" |
132 | do_package_write_deb[noexec] = "1" | 140 | do_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 \ | |||
54 | export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig" | 54 | export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig" |
55 | export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" | 55 | export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" |
56 | 56 | ||
57 | ORIG_DEPENDS := "${DEPENDS}" | 57 | python nativesdk_virtclass_handler () { |
58 | DEPENDS_virtclass-nativesdk ?= "${ORIG_DEPENDS}" | 58 | if not isinstance(e, bb.event.RecipePreFinalise): |
59 | return | ||
59 | 60 | ||
60 | python __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 | ||
88 | addhandler nativesdk_virtclass_handler | ||
89 | |||
85 | do_populate_sysroot[stamp-extra-info] = "" | 90 | do_populate_sysroot[stamp-extra-info] = "" |
86 | do_package[stamp-extra-info] = "" | 91 | do_package[stamp-extra-info] = "" |