diff options
-rwxr-xr-x | bin/bitbake-worker | 1 | ||||
-rw-r--r-- | lib/bb/cooker.py | 1 | ||||
-rw-r--r-- | lib/bb/cookerdata.py | 1 | ||||
-rw-r--r-- | lib/bb/data.py | 2 | ||||
-rw-r--r-- | lib/bb/parse/parse_py/BBHandler.py | 29 | ||||
-rw-r--r-- | lib/bb/tests/parse.py | 1 | ||||
-rw-r--r-- | lib/bblayers/query.py | 26 |
7 files changed, 39 insertions, 22 deletions
diff --git a/bin/bitbake-worker b/bin/bitbake-worker index 2f3e9f72f..7be39370b 100755 --- a/bin/bitbake-worker +++ b/bin/bitbake-worker @@ -457,6 +457,7 @@ class BitbakeWorker(object): for mc in self.databuilder.mcdata: self.databuilder.mcdata[mc].setVar("PRSERV_HOST", self.workerdata["prhost"]) self.databuilder.mcdata[mc].setVar("BB_HASHSERVE", self.workerdata["hashservaddr"]) + self.databuilder.mcdata[mc].setVar("__bbclasstype", "recipe") def handle_newtaskhashes(self, data): self.workerdata["newhashes"] = pickle.loads(data) diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 2adf4d297..1b6ee3032 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -402,6 +402,7 @@ class BBCooker: for mc in self.databuilder.mcdata.values(): mc.renameVar("__depends", "__base_depends") self.add_filewatch(mc.getVar("__base_depends", False), self.configwatcher) + mc.setVar("__bbclasstype", "recipe") self.baseconfig_valid = True self.parsecache_valid = False diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py index d54ac932e..9706948ab 100644 --- a/lib/bb/cookerdata.py +++ b/lib/bb/cookerdata.py @@ -254,6 +254,7 @@ class CookerDataBuilder(object): filtered_keys = bb.utils.approved_variables() bb.data.inheritFromOS(self.basedata, self.savedenv, filtered_keys) self.basedata.setVar("BB_ORIGENV", self.savedenv) + self.basedata.setVar("__bbclasstype", "global") if worker: self.basedata.setVar("BB_WORKERCONTEXT", "1") diff --git a/lib/bb/data.py b/lib/bb/data.py index c09d9b04b..53fe34825 100644 --- a/lib/bb/data.py +++ b/lib/bb/data.py @@ -441,7 +441,7 @@ def generate_dependency_hash(tasklist, gendeps, lookupcache, ignored_vars, fn): def inherits_class(klass, d): val = d.getVar('__inherit_cache', False) or [] - needle = os.path.join('classes', '%s.bbclass' % klass) + needle = '/%s.bbclass' % klass for v in val: if v.endswith(needle): return True diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py index 118911434..18e686838 100644 --- a/lib/bb/parse/parse_py/BBHandler.py +++ b/lib/bb/parse/parse_py/BBHandler.py @@ -44,17 +44,24 @@ def inherit(files, fn, lineno, d): __inherit_cache = d.getVar('__inherit_cache', False) or [] files = d.expand(files).split() for file in files: - 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): - bbpath = d.getVar("BBPATH") - abs_fn, attempts = bb.utils.which(bbpath, file, history=True) - for af in attempts: - if af != abs_fn: - bb.parse.mark_dependency(d, af) - if abs_fn: - file = abs_fn + classtype = d.getVar("__bbclasstype", False) + origfile = file + for t in ["classes-" + classtype, "classes"]: + file = origfile + if not os.path.isabs(file) and not file.endswith(".bbclass"): + file = os.path.join(t, '%s.bbclass' % file) + + if not os.path.isabs(file): + bbpath = d.getVar("BBPATH") + abs_fn, attempts = bb.utils.which(bbpath, file, history=True) + for af in attempts: + if af != abs_fn: + bb.parse.mark_dependency(d, af) + if abs_fn: + file = abs_fn + + if os.path.exists(file): + break if not os.path.exists(file): raise ParseError("Could not inherit file %s" % (file), fn, lineno) diff --git a/lib/bb/tests/parse.py b/lib/bb/tests/parse.py index 1a3b74934..ee7f2534f 100644 --- a/lib/bb/tests/parse.py +++ b/lib/bb/tests/parse.py @@ -164,6 +164,7 @@ python () { # become unset/disappear. # def test_parse_classextend_contamination(self): + self.d.setVar("__bbclasstype", "recipe") cls = self.parsehelper(self.classextend_bbclass, suffix=".bbclass") #clsname = os.path.basename(cls.name).replace(".bbclass", "") self.classextend = self.classextend.replace("###CLASS###", cls.name) diff --git a/lib/bblayers/query.py b/lib/bblayers/query.py index 9142ec447..afd39518e 100644 --- a/lib/bblayers/query.py +++ b/lib/bblayers/query.py @@ -57,11 +57,12 @@ are overlayed will also be listed, with a " (skipped)" suffix. # Check for overlayed .bbclass files classes = collections.defaultdict(list) for layerdir in self.bblayers: - classdir = os.path.join(layerdir, 'classes') - if os.path.exists(classdir): - for classfile in os.listdir(classdir): - if os.path.splitext(classfile)[1] == '.bbclass': - classes[classfile].append(classdir) + for c in ["classes-global", "classes-recipe", "classes"]: + classdir = os.path.join(layerdir, c) + if os.path.exists(classdir): + for classfile in os.listdir(classdir): + if os.path.splitext(classfile)[1] == '.bbclass': + classes[classfile].append(classdir) # Locating classes and other files is a bit more complicated than recipes - # layer priority is not a factor; instead BitBake uses the first matching @@ -124,9 +125,14 @@ skipped recipes will also be listed, with a " (skipped)" suffix. if inherits: bbpath = str(self.tinfoil.config_data.getVar('BBPATH')) for classname in inherits: - classfile = 'classes/%s.bbclass' % classname - if not bb.utils.which(bbpath, classfile, history=False): - logger.error('No class named %s found in BBPATH', classfile) + found = False + for c in ["classes-global", "classes-recipe", "classes"]: + cfile = c + '/%s.bbclass' % classname + if bb.utils.which(bbpath, cfile, history=False): + found = True + break + if not found: + logger.error('No class named %s found in BBPATH', classname) sys.exit(1) pkg_pn = self.tinfoil.cooker.recipecaches[mc].pkg_pn @@ -174,7 +180,7 @@ skipped recipes will also be listed, with a " (skipped)" suffix. logger.plain(" %s %s%s", layer.ljust(20), ver, skipped) global_inherit = (self.tinfoil.config_data.getVar('INHERIT') or "").split() - cls_re = re.compile('classes/') + cls_re = re.compile('classes.*/') preffiles = [] show_unique_pn = [] @@ -407,7 +413,7 @@ NOTE: .bbappend files can impact the dependencies. self.check_cross_depends("RRECOMMENDS", layername, f, best, args.filenames, ignore_layers) # The inherit class - cls_re = re.compile('classes/') + cls_re = re.compile('classes.*/') if f in self.tinfoil.cooker_data.inherits: inherits = self.tinfoil.cooker_data.inherits[f] for cls in inherits: |