From c4257ed8b1040a5a0e9a95846d81961741239116 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 27 Jan 2021 14:48:21 +0000 Subject: native: Stop clearing PACKAGES Native recipes have been special and they don't have packages generated from them. The RDEPENDS/RPROVIDES and other runtime package specific variables can contain important data about dependencies recipes need though and currently it is required to write this information explicitly in the native case. We now delete the packaging tasks for native recipes which removes the need to clear PACKAGES. The next step to improve the metadata is to stop clearing it and ensure any entries in these variables are remapped appropriately. The R* variables were already being processed by the class extension code but the implementation was suboptimal. This patch stops clearing PACKAGES and PACKAGES_DYNAMIC and fixes the places where that caused issues in OE-Core, for example PACKAGES additions in anonymous python without the "-native" suffix and a case where the included classes caused a self reference in DEPENDS which would once have been removed by the previous code. The implementation uses datastore/parser parameters to ensure that the variable overrides are not overwritten when calling setVar which is appropriate for a function as close to the core as this one is. Some now unneeded code in python3-setuptools is dropped, there are further changes like this which can follow. This change was verified with OE-Core by comparing task-depends.dot generated by "bitbake world -g" before and after the change, the files were identical. (From OE-Core rev: fd6a007efa7cb45101a66f294af81d9d33bb3fab) Signed-off-by: Richard Purdie --- meta/classes/native.bbclass | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'meta/classes') diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass index 08106e345c..a0838e41b9 100644 --- a/meta/classes/native.bbclass +++ b/meta/classes/native.bbclass @@ -5,20 +5,12 @@ inherit relocatable # no need for them to be a direct target of 'world' EXCLUDE_FROM_WORLD = "1" -PACKAGES = "" -PACKAGES_class-native = "" -PACKAGES_DYNAMIC = "" -PACKAGES_DYNAMIC_class-native = "" PACKAGE_ARCH = "${BUILD_ARCH}" # used by cmake class OECMAKE_RPATH = "${libdir}" OECMAKE_RPATH_class-native = "${libdir}" -# When this class has packaging enabled, setting -# RPROVIDES becomes unnecessary. -RPROVIDES = "${PN}" - TARGET_ARCH = "${BUILD_ARCH}" TARGET_OS = "${BUILD_OS}" TARGET_VENDOR = "${BUILD_VENDOR}" @@ -138,7 +130,7 @@ python native_virtclass_handler () { if "native" not in classextend: return - def map_dependencies(varname, d, suffix = ""): + def map_dependencies(varname, d, suffix = "", selfref=True): if suffix: varname = varname + "_" + suffix deps = d.getVar(varname) @@ -148,22 +140,25 @@ python native_virtclass_handler () { newdeps = [] for dep in deps: if dep == pn: - continue + if not selfref: + continue + newdeps.append(dep) elif "-cross-" in dep: newdeps.append(dep.replace("-cross", "-native")) elif not dep.endswith("-native"): - newdeps.append(dep + "-native") + newdeps.append(dep.replace("-native", "") + "-native") else: newdeps.append(dep) - d.setVar(varname, " ".join(newdeps)) + d.setVar(varname, " ".join(newdeps), parsing=True) - map_dependencies("DEPENDS", e.data) - for pkg in [e.data.getVar("PN"), "", "${PN}"]: + map_dependencies("DEPENDS", e.data, selfref=False) + for pkg in e.data.getVar("PACKAGES", False).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) + map_dependencies("PACKAGES", e.data) provides = e.data.getVar("PROVIDES") nprovides = [] -- cgit v1.2.3-54-g00ecf