cookerdata: Be consistent with what type bb_data represents
PATCH 1/2 cookerdata: Be consistent with what type bb_data represents
In _parse_recipe(), bb_data was initially a datastore object, but then after the call to bb.parse.handle() it was all of a sudden turned into a dict of variant:datastore pairs. At the same time, parseRecipeVariants() used bb_data for datastore objects, while parseRecipe() used it for the dicts of variant:datastore pairs.
Change these functions to consistently use "bb_data" for datastore objects and use "datastores" for the dicts of variant:datastore pairs.
Signed-off-by Peter Kjellerstedt <[email protected]>
--- bitbake/lib/bb/cookerdata.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
bitbake/lib/bb/cookerdata.py +5 -6
@@ -503,8 +503,8 @@ class CookerDataBuilder(object): if appends: bb_data.setVar('__BBAPPEND', " ".join(appends)) - bb_data = bb.parse.handle(bbfile, bb_data) - return bb_data + + return bb.parse.handle(bbfile, bb_data) def parseRecipeVariants(self, bbfile, appends, virtonly=False, mc=None, layername=None): """
@@ -516,8 +516,7 @@ class CookerDataBuilder(object): (bbfile, virtual, mc) = bb.cache.virtualfn2realfn(bbfile) bb_data = self.mcdata[mc].createCopy() bb_data.setVar("__ONLYFINALISE", virtual or "default") - datastores = self._parse_recipe(bb_data, bbfile, appends, mc, layername) - return datastores + return self._parse_recipe(bb_data, bbfile, appends, mc, layername) if mc is not None: bb_data = self.mcdata[mc].createCopy()
@@ -543,5 +542,5 @@ class CookerDataBuilder(object): """ logger.debug("Parsing %s (full)" % virtualfn) (fn, virtual, mc) = bb.cache.virtualfn2realfn(virtualfn) - bb_data = self.parseRecipeVariants(virtualfn, appends, virtonly=True, layername=layername) - return bb_data[virtual] + datastores = self.parseRecipeVariants(virtualfn, appends, virtonly=True, layername=layername) + return datastores[virtual]
PATCH 2/2 cache: Simplify virtualfn2realfn()
Also correct the description of variant2virtual().
Signed-off-by Peter Kjellerstedt <[email protected]>
--- bitbake/lib/bb/cache.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
bitbake/lib/bb/cache.py +2 -4
@@ -344,9 +344,7 @@ def virtualfn2realfn(virtualfn): """ mc = "" if virtualfn.startswith('mc:') and virtualfn.count(':') >= 2: - elems = virtualfn.split(':') - mc = elems[1] - virtualfn = ":".join(elems[2:]) + (_, mc, virtualfn) = virtualfn.split(':', 2) fn = virtualfn cls = ""
@@ -369,7 +367,7 @@ def realfn2virtual(realfn, cls, mc): def variant2virtual(realfn, variant): """ - Convert a real filename + the associated subclass keyword to a virtual filename + Convert a real filename + a variant to a virtual filename """ if variant == "": return realfn