summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/classextend.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/classextend.py')
-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