summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-04-15 16:25:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-05-27 10:47:05 +0100
commitedbf8d3999126e3c271a47dada54d1724f59f573 (patch)
tree98f7ca63aba6fa135555406454a7d4fcb78f4159 /meta/lib/oe
parent706b623c12f4576805e999ece91acf89ea22e5ef (diff)
downloadpoky-edbf8d3999126e3c271a47dada54d1724f59f573.tar.gz
multilib/recipes: Use new RecipePostKeyExpansion event
There are issues with multilib due to the ordering of events where some functions see the remapped multilib dependencies and some do not. A significant problem is that the multilib class needs to make some changes before key expansion and some afterwards but by using existing event handlers, some code sees things in a partially translated state, leading to bugs. This patch changes things to use a new event handler from bitbake which makes the ordering of the changes explcit. The challenge in doing this is that it breaks some existing anonymous python and dyanmic assignments. In some cases these used to be translated and no longer are, meaning MLPREFIX has to be added. In some cases these are now translated and the MLPREFIX can be removed. This change does now make it very clear when MLPREFIX is required and when it is not, its just the migration path which is harder. The patch changes the small number of cases where fixes are needed. In particular, where a variable like RDEPENDS is conditionally extended (e.g. with an override), MLPREFIX is now required. This patch also reverts: base: Revert 'base.bbclass: considering multilib when setting LICENSE_EXCLUSION' This reverts 6597130256a1609c3e05ec5891aceaf549c37985 as the changes to multilib datastore handling mean its no longer necessary. (From OE-Core rev: b3fda056a674889cd9697e779de023d4f993d3ce) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/classextend.py35
1 files changed, 32 insertions, 3 deletions
diff --git a/meta/lib/oe/classextend.py b/meta/lib/oe/classextend.py
index f02fbe9fba..e1049ce3e8 100644
--- a/meta/lib/oe/classextend.py
+++ b/meta/lib/oe/classextend.py
@@ -4,11 +4,21 @@
4 4
5import collections 5import collections
6 6
7def get_packages(d):
8 pkgs = d.getVar("PACKAGES_NONML")
9 extcls = d.getVar("EXTENDERCLASS")
10 return extcls.rename_packages_internal(pkgs)
11
12def get_depends(varprefix, d):
13 extcls = d.getVar("EXTENDERCLASS")
14 return extcls.map_depends_variable(varprefix + "_NONML")
15
7class ClassExtender(object): 16class ClassExtender(object):
8 def __init__(self, extname, d): 17 def __init__(self, extname, d):
9 self.extname = extname 18 self.extname = extname
10 self.d = d 19 self.d = d
11 self.pkgs_mapping = [] 20 self.pkgs_mapping = []
21 self.d.setVar("EXTENDERCLASS", self)
12 22
13 def extend_name(self, name): 23 def extend_name(self, name):
14 if name.startswith("kernel-") or name == "virtual/kernel": 24 if name.startswith("kernel-") or name == "virtual/kernel":
@@ -24,7 +34,7 @@ class ClassExtender(object):
24 if not subs.startswith(self.extname): 34 if not subs.startswith(self.extname):
25 return "virtual/" + self.extname + "-" + subs 35 return "virtual/" + self.extname + "-" + subs
26 return name 36 return name
27 if name.startswith("/"): 37 if name.startswith("/") or (name.startswith("${") and name.endswith("}")):
28 return name 38 return name
29 if not name.startswith(self.extname): 39 if not name.startswith(self.extname):
30 return self.extname + "-" + name 40 return self.extname + "-" + name
@@ -89,8 +99,14 @@ class ClassExtender(object):
89 for dep in deps: 99 for dep in deps:
90 newdeps[self.map_depends(dep)] = deps[dep] 100 newdeps[self.map_depends(dep)] = deps[dep]
91 101
92 self.d.setVar(varname, bb.utils.join_deps(newdeps, False).replace("EXTENDPKGV", "${EXTENDPKGV}")) 102 if not varname.endswith("_NONML"):
103 #if varname == "DEPENDS":
104 self.d.renameVar(varname, varname + "_NONML")
105 self.d.setVar(varname, "${@oe.classextend.get_depends('%s', d)}" % varname)
106 self.d.appendVarFlag(varname, "vardeps", " " + varname + "_NONML")
107 ret = bb.utils.join_deps(newdeps, False).replace("EXTENDPKGV", "${EXTENDPKGV}")
93 self.d.setVar("EXTENDPKGV", orig) 108 self.d.setVar("EXTENDPKGV", orig)
109 return ret
94 110
95 def map_packagevars(self): 111 def map_packagevars(self):
96 for pkg in (self.d.getVar("PACKAGES").split() + [""]): 112 for pkg in (self.d.getVar("PACKAGES").split() + [""]):
@@ -109,10 +125,23 @@ class ClassExtender(object):
109 continue 125 continue
110 self.pkgs_mapping.append([pkg, self.extend_name(pkg)]) 126 self.pkgs_mapping.append([pkg, self.extend_name(pkg)])
111 127
112 self.d.setVar("PACKAGES", " ".join([row[1] for row in self.pkgs_mapping])) 128 self.d.renameVar("PACKAGES", "PACKAGES_NONML")
129 self.d.setVar("PACKAGES", "${@oe.classextend.get_packages(d)}")
130
131 def rename_packages_internal(self, pkgs):
132 self.pkgs_mapping = []
133 for pkg in (self.d.expand(pkgs) or "").split():
134 if pkg.startswith(self.extname):
135 self.pkgs_mapping.append([pkg.split(self.extname + "-")[1], pkg])
136 continue
137 self.pkgs_mapping.append([pkg, self.extend_name(pkg)])
138
139 return " ".join([row[1] for row in self.pkgs_mapping])
113 140
114 def rename_package_variables(self, variables): 141 def rename_package_variables(self, variables):
115 for pkg_mapping in self.pkgs_mapping: 142 for pkg_mapping in self.pkgs_mapping:
143 if pkg_mapping[0].startswith("${") and pkg_mapping[0].endswith("}"):
144 continue
116 for subs in variables: 145 for subs in variables:
117 self.d.renameVar("%s_%s" % (subs, pkg_mapping[0]), "%s_%s" % (subs, pkg_mapping[1])) 146 self.d.renameVar("%s_%s" % (subs, pkg_mapping[0]), "%s_%s" % (subs, pkg_mapping[1]))
118 147