summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/native.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-01-06 16:06:10 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-01-10 11:23:45 +0000
commitd26c72b7dccaf4802914dafcc95911f4d166086d (patch)
tree6ffa36640c766678dec0c616db18ca66b7b0044f /meta/classes-recipe/native.bbclass
parentcfabbd46f53bfdcd0ec17e475f05dd322d3deebe (diff)
downloadpoky-d26c72b7dccaf4802914dafcc95911f4d166086d.tar.gz
native: Improve ${PN}-XXX package name handling
If a recipe has something like: RPROVIDES:${PN}-xxx = "yyy" then the current code will turn this into: RPROVIDES:${BPN}-native-xxx = "yyy-native" which can lead to errors. Add in some handling for this special case in the class extension code. The corresponding entry in PACKAGES is correctly remapped, the variables aren't remapped to match though. Note that merging this does trigger new dependencies to be exposed, some of which can't be met or are incorrect. These need to be fixed on a case by case basis. There was also a problem in the existing code when handling anonymous python in PACKAGES since it would pass bizarre package names like "d)}" to the remapping code. This patch changes it to ignore anonymous python since in the native case, this likely isn't wanted anyway. This also then avoids ${PN}-ptest in the native case which was a common dependency problem. (From OE-Core rev: e2fd81e221c25fc21d532e020ddd8aaac0c22ede) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/native.bbclass')
-rw-r--r--meta/classes-recipe/native.bbclass15
1 files changed, 13 insertions, 2 deletions
diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass
index d9651a7f22..1d9432138e 100644
--- a/meta/classes-recipe/native.bbclass
+++ b/meta/classes-recipe/native.bbclass
@@ -119,6 +119,7 @@ SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
119INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}" 119INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}"
120 120
121python native_virtclass_handler () { 121python native_virtclass_handler () {
122 import re
122 pn = e.data.getVar("PN") 123 pn = e.data.getVar("PN")
123 if not pn.endswith("-native"): 124 if not pn.endswith("-native"):
124 return 125 return
@@ -158,10 +159,20 @@ python native_virtclass_handler () {
158 newdeps.append(dep.replace(pn, bpn) + "-native") 159 newdeps.append(dep.replace(pn, bpn) + "-native")
159 else: 160 else:
160 newdeps.append(dep) 161 newdeps.append(dep)
161 d.setVar(varname, " ".join(newdeps)) 162 output_varname = varname
163 # Handle ${PN}-xxx -> ${BPN}-xxx-native
164 if suffix != "${PN}" and "${PN}" in suffix:
165 output_varname = varname.replace("${PN}", "${BPN}") + "-native"
166 d.renameVar(varname, output_varname)
167 d.setVar(output_varname, " ".join(newdeps))
162 168
163 map_dependencies("DEPENDS", e.data, selfref=False) 169 map_dependencies("DEPENDS", e.data, selfref=False)
164 for pkg in e.data.getVar("PACKAGES", False).split(): 170 # We need to handle things like ${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}
171 # and not pass ${PN}-test since in the native case it would be ignored. This does mean we ignore
172 # anonymous python derived PACKAGES entries.
173 for pkg in re.split(r"\${@(?:{.*?}|.)+?}|\s", d.getVar("PACKAGES", False)):
174 if not pkg:
175 continue
165 map_dependencies("RDEPENDS", e.data, pkg) 176 map_dependencies("RDEPENDS", e.data, pkg)
166 map_dependencies("RRECOMMENDS", e.data, pkg) 177 map_dependencies("RRECOMMENDS", e.data, pkg)
167 map_dependencies("RSUGGESTS", e.data, pkg) 178 map_dependencies("RSUGGESTS", e.data, pkg)