summaryrefslogtreecommitdiffstats
path: root/meta/classes/native.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-27 14:48:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-29 21:21:53 +0000
commitc4257ed8b1040a5a0e9a95846d81961741239116 (patch)
tree0d61b9e3ad2e8590406942142868d211e36dac03 /meta/classes/native.bbclass
parentcff7db890cdfab41cc8f74e3dc378660d9b6219e (diff)
downloadpoky-c4257ed8b1040a5a0e9a95846d81961741239116.tar.gz
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/native.bbclass')
-rw-r--r--meta/classes/native.bbclass23
1 files changed, 9 insertions, 14 deletions
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
5# no need for them to be a direct target of 'world' 5# no need for them to be a direct target of 'world'
6EXCLUDE_FROM_WORLD = "1" 6EXCLUDE_FROM_WORLD = "1"
7 7
8PACKAGES = ""
9PACKAGES_class-native = ""
10PACKAGES_DYNAMIC = ""
11PACKAGES_DYNAMIC_class-native = ""
12PACKAGE_ARCH = "${BUILD_ARCH}" 8PACKAGE_ARCH = "${BUILD_ARCH}"
13 9
14# used by cmake class 10# used by cmake class
15OECMAKE_RPATH = "${libdir}" 11OECMAKE_RPATH = "${libdir}"
16OECMAKE_RPATH_class-native = "${libdir}" 12OECMAKE_RPATH_class-native = "${libdir}"
17 13
18# When this class has packaging enabled, setting
19# RPROVIDES becomes unnecessary.
20RPROVIDES = "${PN}"
21
22TARGET_ARCH = "${BUILD_ARCH}" 14TARGET_ARCH = "${BUILD_ARCH}"
23TARGET_OS = "${BUILD_OS}" 15TARGET_OS = "${BUILD_OS}"
24TARGET_VENDOR = "${BUILD_VENDOR}" 16TARGET_VENDOR = "${BUILD_VENDOR}"
@@ -138,7 +130,7 @@ python native_virtclass_handler () {
138 if "native" not in classextend: 130 if "native" not in classextend:
139 return 131 return
140 132
141 def map_dependencies(varname, d, suffix = ""): 133 def map_dependencies(varname, d, suffix = "", selfref=True):
142 if suffix: 134 if suffix:
143 varname = varname + "_" + suffix 135 varname = varname + "_" + suffix
144 deps = d.getVar(varname) 136 deps = d.getVar(varname)
@@ -148,22 +140,25 @@ python native_virtclass_handler () {
148 newdeps = [] 140 newdeps = []
149 for dep in deps: 141 for dep in deps:
150 if dep == pn: 142 if dep == pn:
151 continue 143 if not selfref:
144 continue
145 newdeps.append(dep)
152 elif "-cross-" in dep: 146 elif "-cross-" in dep:
153 newdeps.append(dep.replace("-cross", "-native")) 147 newdeps.append(dep.replace("-cross", "-native"))
154 elif not dep.endswith("-native"): 148 elif not dep.endswith("-native"):
155 newdeps.append(dep + "-native") 149 newdeps.append(dep.replace("-native", "") + "-native")
156 else: 150 else:
157 newdeps.append(dep) 151 newdeps.append(dep)
158 d.setVar(varname, " ".join(newdeps)) 152 d.setVar(varname, " ".join(newdeps), parsing=True)
159 153
160 map_dependencies("DEPENDS", e.data) 154 map_dependencies("DEPENDS", e.data, selfref=False)
161 for pkg in [e.data.getVar("PN"), "", "${PN}"]: 155 for pkg in e.data.getVar("PACKAGES", False).split():
162 map_dependencies("RDEPENDS", e.data, pkg) 156 map_dependencies("RDEPENDS", e.data, pkg)
163 map_dependencies("RRECOMMENDS", e.data, pkg) 157 map_dependencies("RRECOMMENDS", e.data, pkg)
164 map_dependencies("RSUGGESTS", e.data, pkg) 158 map_dependencies("RSUGGESTS", e.data, pkg)
165 map_dependencies("RPROVIDES", e.data, pkg) 159 map_dependencies("RPROVIDES", e.data, pkg)
166 map_dependencies("RREPLACES", e.data, pkg) 160 map_dependencies("RREPLACES", e.data, pkg)
161 map_dependencies("PACKAGES", e.data)
167 162
168 provides = e.data.getVar("PROVIDES") 163 provides = e.data.getVar("PROVIDES")
169 nprovides = [] 164 nprovides = []