cache: extract method to remove default parameters
PATCH 1/1 cache: extract method to remove default parameters
Since the virtonly parameter is only used with true inside loadDataFull we can extract.
By removing the virtonly parameter we can now remove the mc and used what was passed as an argument before.
Signed-off-by Maxime Roussin-Bélanger <[email protected]>
--- bitbake/lib/bb/cache.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
bitbake/lib/bb/cache.py +13 -15
@@ -324,26 +324,17 @@ class NoCache(object): To do this, we need to parse the file. """ logger.debug(1, "Parsing %s (full)" % virtualfn) - (fn, virtual, mc) = virtualfn2realfn(virtualfn) - bb_data = self.load_bbfile(virtualfn, appends, virtonly=True) - return bb_data[virtual] + return self.load_virtual_bbfile(virtualfn, appends) - def load_bbfile(self, bbfile, appends, virtonly = False, mc=None): + def load_bbfile(self, bbfile, appends): """ Load and parse one .bb build file Return the data and whether parsing resulted in the file being skipped """ - if virtonly: - (bbfile, virtual, mc) = virtualfn2realfn(bbfile) - bb_data = self.databuilder.mcdata[mc].createCopy() - bb_data.setVar("__ONLYFINALISE", virtual or "default") - datastores = parse_recipe(bb_data, bbfile, appends, mc) - return datastores - - if mc is not None: - bb_data = self.databuilder.mcdata[mc].createCopy() - return parse_recipe(bb_data, bbfile, appends, mc) + if self.mc is not None: + bb_data = self.databuilder.mcdata[self.mc].createCopy() + return parse_recipe(bb_data, bbfile, appends, self.mc) bb_data = self.data.createCopy() datastores = parse_recipe(bb_data, bbfile, appends)
@@ -358,6 +349,13 @@ class NoCache(object): return datastores + def load_virtual_bbfile(self, virtualfn, appends): + (_, virtual, mc) = virtualfn2realfn(virtualfn) + bb_data = self.databuilder.mcdata[mc].createCopy() + bb_data.setVar("__ONLYFINALISE", virtual or "default") + datastores = parse_recipe(bb_data, virtualfn, appends, mc) + return datastores[virtual] + class Cache(NoCache): """ BitBake Cache implementation
@@ -502,7 +500,7 @@ class Cache(NoCache): """Parse the specified filename, returning the recipe information""" self.logger.debug(1, "Parsing %s", filename) infos = [] - datastores = self.load_bbfile(filename, appends, mc=self.mc) + datastores = self.load_bbfile(filename, appends) depends = [] variants = [] # Process the "real" fn last so we can store variants list
Signature · 1 line
2.28.0