The inherits cache contains duplicate entries, some with the full patch, some
just starting classes/xxx. This is a waste of parse time and potentially
error prone. This patch fixes various pieces of code so the absolute paths are
always preferred and work correctly. The inherits_class function did not work
with full paths so the patch fixes this.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
def inherits_class(klass, d):
val = getVar('__inherit_cache', d) or []
- if os.path.join('classes', '%s.bbclass' % klass) in val:
- return True
+ needle = os.path.join('classes', '%s.bbclass' % klass)
+ for v in val:
+ if v.endswith(needle):
+ return True
return False
if not os.path.isabs(file) and not file.endswith(".bbclass"):
file = os.path.join('classes', '%s.bbclass' % file)
+ if not os.path.isabs(file):
+ dname = os.path.dirname(fn)
+ bbpath = "%s:%s" % (dname, d.getVar("BBPATH", True))
+ abs_fn = bb.utils.which(bbpath, file)
+ if abs_fn:
+ file = abs_fn
+
if not file in __inherit_cache:
logger.log(logging.DEBUG -1, "BB %s:%d: inheriting %s", fn, lineno, file)
__inherit_cache.append( file )