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:48:56 +0100 |
commit | f183c7cfe377fa6ed2777605c3590a9dda2060df (patch) | |
tree | b00803dd7a3ca343ad01553d86b80ff2dd6945d0 /meta/classes | |
parent | f6a38cd75edb46858da6950b5ec029db8a12d801 (diff) | |
download | openembedded-core-f183c7cfe377fa6ed2777605c3590a9dda2060df.tar.gz openembedded-core-f183c7cfe377fa6ed2777605c3590a9dda2060df.tar.bz2 openembedded-core-f183c7cfe377fa6ed2777605c3590a9dda2060df.zip |
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.
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): EXTRA_OEMAKE = "" DEPENDS_prepend = "${@autotools_dep_prepend(d)}" -DEPENDS_virtclass-native_prepend = "${@autotools_dep_prepend(d)}" -DEPENDS_virtclass-nativesdk_prepend = "${@autotools_dep_prepend(d)}" inherit siteinfo diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 6f0484e26c..119b052f3f 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -69,8 +69,6 @@ def base_dep_prepend(d): BASEDEPENDS = "${@base_dep_prepend(d)}" DEPENDS_prepend="${BASEDEPENDS} " -DEPENDS_virtclass-native_prepend="${BASEDEPENDS} " -DEPENDS_virtclass-nativesdk_prepend="${BASEDEPENDS} " 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)}" # 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 e06f02a1bf..3a31b6c091 100644 --- a/meta/classes/native.bbclass +++ b/meta/classes/native.bbclass @@ -80,17 +80,25 @@ EXTRA_NATIVE_PKGCONFIG_PATH ?= "" PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" PKG_CONFIG_SYSROOT_DIR = "" -ORIG_DEPENDS := "${DEPENDS}" -ORIG_RDEPENDS := "${RDEPENDS}" - -DEPENDS_virtclass-native ?= "${ORIG_DEPENDS}" -RDEPENDS_virtclass-native ?= "${ORIG_RDEPENDS}" - -python __anonymous () { - if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""): - pn = bb.data.getVar("PN", d, True) - depends = bb.data.getVar("DEPENDS_virtclass-native", d, True) - deps = bb.utils.explode_deps(depends) +python native_virtclass_handler () { + if not isinstance(e, bb.event.RecipePreFinalise): + return + + classextend = bb.data.getVar('BBCLASSEXTEND', e.data, True) or "" + if "native" not in classextend: + return + + pn = bb.data.getVar("PN", e.data, True) + if not pn.endswith("-native"): + return + + def map_dependencies(varname, d, suffix = ""): + if suffix: + varname = varname + "_" + suffix + deps = bb.data.getVar(varname, d, True) + if not deps: + return + deps = bb.utils.explode_deps(deps) newdeps = [] for dep in deps: if dep.endswith("-cross"): @@ -99,29 +107,29 @@ python __anonymous () { newdeps.append(dep + "-native") else: newdeps.append(dep) - bb.data.setVar("DEPENDS_virtclass-native", " ".join(newdeps), d) - rdepends = bb.data.getVar("RDEPENDS_virtclass-native", d, True) - rdeps = bb.utils.explode_deps(rdepends) - newdeps = [] - for dep in rdeps: - if dep.endswith("-cross"): - newdeps.append(dep.replace("-cross", "-native")) - elif not dep.endswith("-native"): - newdeps.append(dep + "-native") - else: - newdeps.append(dep) - bb.data.setVar("RDEPENDS_virtclass-native", " ".join(newdeps), d) - provides = bb.data.getVar("PROVIDES", d, True) - for prov in provides.split(): - if prov.find(pn) != -1: - continue - if not prov.endswith("-native"): - - provides = provides.replace(prov, prov + "-native") - bb.data.setVar("PROVIDES", provides, d) - bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-native", d) + bb.data.setVar(varname, " ".join(newdeps), d) + + map_dependencies("DEPENDS", e.data) + for pkg in (e.data.getVar("PACKAGES", True).split() + [""]): + map_dependencies("RDEPENDS", e.data, pkg) + map_dependencies("RRECOMMENDS", e.data, pkg) + map_dependencies("RSUGGESTS", e.data, pkg) + map_dependencies("RPROVIDES", e.data, pkg) + map_dependencies("RREPLACES", e.data, pkg) + + provides = bb.data.getVar("PROVIDES", e.data, True) + for prov in provides.split(): + if prov.find(pn) != -1: + continue + if not prov.endswith("-native"): + provides = provides.replace(prov, prov + "-native") + bb.data.setVar("PROVIDES", provides, e.data) + + bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", e.data, False) + ":virtclass-native", e.data) } +addhandler native_virtclass_handler + do_package[noexec] = "1" do_package_write_ipk[noexec] = "1" 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 \ export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig" export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" -ORIG_DEPENDS := "${DEPENDS}" -DEPENDS_virtclass-nativesdk ?= "${ORIG_DEPENDS}" +python nativesdk_virtclass_handler () { + if not isinstance(e, bb.event.RecipePreFinalise): + return -python __anonymous () { - pn = bb.data.getVar("PN", d, True) - depends = bb.data.getVar("DEPENDS_virtclass-nativesdk", d, True) + pn = bb.data.getVar("PN", e.data, True) + if not pn.endswith("-nativesdk"): + return + + depends = bb.data.getVar("DEPENDS", e.data, True) deps = bb.utils.explode_deps(depends) newdeps = [] for dep in deps: @@ -71,16 +74,18 @@ python __anonymous () { newdeps.append(dep + "-nativesdk") else: newdeps.append(dep) - bb.data.setVar("DEPENDS_virtclass-nativesdk", " ".join(newdeps), d) - provides = bb.data.getVar("PROVIDES", d, True) + bb.data.setVar("DEPENDS", " ".join(newdeps), e.data) + provides = bb.data.getVar("PROVIDES", e.data, True) for prov in provides.split(): if prov.find(pn) != -1: continue if not prov.endswith("-nativesdk"): provides = provides.replace(prov, prov + "-nativesdk") - bb.data.setVar("PROVIDES", provides, d) - bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-nativesdk", d) + bb.data.setVar("PROVIDES", provides, e.data) + bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", e.data, False) + ":virtclass-nativesdk", e.data) } +addhandler nativesdk_virtclass_handler + do_populate_sysroot[stamp-extra-info] = "" do_package[stamp-extra-info] = "" |