From 3dc3fe32e315ecab35912dd8389626bea695f96f Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 11 Dec 2012 00:02:50 +0000 Subject: bitbake: BBhandler/data: Fix __inherit_cache duplication 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. (Bitbake rev: f3a71e509af196391ec126d079cf1bd178e62ad5) Signed-off-by: Richard Purdie --- bitbake/lib/bb/data.py | 6 ++++-- bitbake/lib/bb/parse/parse_py/BBHandler.py | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 9a32353d68..dc5a425d1c 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py @@ -357,6 +357,8 @@ def generate_dependencies(d): 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 diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 92c55f531a..e6039e11a2 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -74,6 +74,13 @@ def inherit(files, fn, lineno, d): 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 ) -- cgit v1.2.3-54-g00ecf