cachedata.fakerootdirs[fn] = self.fakerootdirs
cachedata.extradepsfunc[fn] = self.extradepsfunc
+def virtualfn2realfn(virtualfn):
+ """
+ Convert a virtual file name to a real one + the associated subclass keyword
+ """
+ fn = virtualfn
+ cls = ""
+ if virtualfn.startswith('virtual:'):
+ elems = virtualfn.split(':')
+ cls = ":".join(elems[1:-1])
+ fn = elems[-1]
+ return (fn, cls)
+
+def realfn2virtual(realfn, cls):
+ """
+ Convert a real filename + the associated subclass keyword to a virtual filename
+ """
+ if cls == "":
+ return realfn
+ return "virtual:" + cls + ":" + realfn
class Cache(object):
"""
len(self.depends_cache)),
self.data)
-
- @staticmethod
- def virtualfn2realfn(virtualfn):
- """
- Convert a virtual file name to a real one + the associated subclass keyword
- """
-
- fn = virtualfn
- cls = ""
- if virtualfn.startswith('virtual:'):
- elems = virtualfn.split(':')
- cls = ":".join(elems[1:-1])
- fn = elems[-1]
- return (fn, cls)
-
- @staticmethod
- def realfn2virtual(realfn, cls):
- """
- Convert a real filename + the associated subclass keyword to a virtual filename
- """
- if cls == "":
- return realfn
- return "virtual:" + cls + ":" + realfn
-
@classmethod
def loadDataFull(cls, virtualfn, appends, cfgData):
"""
To do this, we need to parse the file.
"""
- (fn, virtual) = cls.virtualfn2realfn(virtualfn)
+ (fn, virtual) = virtualfn2realfn(virtualfn)
logger.debug(1, "Parsing %s (full)", fn)
for variant, data in sorted(datastores.items(),
key=lambda i: i[0],
reverse=True):
- virtualfn = cls.realfn2virtual(filename, variant)
+ virtualfn = realfn2virtual(filename, variant)
variants.append(variant)
depends = depends + (data.getVar("__depends", False) or [])
if depends and not variant:
# info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo]
info_array = self.depends_cache[filename]
for variant in info_array[0].variants:
- virtualfn = self.realfn2virtual(filename, variant)
+ virtualfn = realfn2virtual(filename, variant)
infos.append((virtualfn, self.depends_cache[virtualfn]))
else:
return self.parse(filename, appends, configdata, self.caches_array)
invalid = False
for cls in info_array[0].variants:
- virtualfn = self.realfn2virtual(fn, cls)
+ virtualfn = realfn2virtual(fn, cls)
self.clean.add(virtualfn)
if virtualfn not in self.depends_cache:
logger.debug(2, "Cache: %s is not cached", virtualfn)
# If any one of the variants is not present, mark as invalid for all
if invalid:
for cls in info_array[0].variants:
- virtualfn = self.realfn2virtual(fn, cls)
+ virtualfn = realfn2virtual(fn, cls)
if virtualfn in self.clean:
logger.debug(2, "Cache: Removing %s from cache", virtualfn)
self.clean.remove(virtualfn)
Save data we need into the cache
"""
- realfn = self.virtualfn2realfn(file_name)[0]
+ realfn = virtualfn2realfn(file_name)[0]
info_array = []
for cache_class in self.caches_array:
# this showEnvironment() code path doesn't use the cache
self.parseConfiguration()
- fn, cls = bb.cache.Cache.virtualfn2realfn(buildfile)
+ fn, cls = bb.cache.virtualfn2realfn(buildfile)
fn = self.matchFile(fn)
- fn = bb.cache.Cache.realfn2virtual(fn, cls)
+ fn = bb.cache.realfn2virtual(fn, cls)
elif len(pkgs_to_build) == 1:
ignore = self.expanded_data.getVar("ASSUME_PROVIDED", True) or ""
if pkgs_to_build[0] in set(ignore.split()):
if (task == None):
task = self.configuration.cmd
- fn, cls = bb.cache.Cache.virtualfn2realfn(buildfile)
+ fn, cls = bb.cache.virtualfn2realfn(buildfile)
fn = self.matchFile(fn)
self.buildSetVars()
self.caches_array)
infos = dict(infos)
- fn = bb.cache.Cache.realfn2virtual(fn, cls)
+ fn = bb.cache.realfn2virtual(fn, cls)
try:
info_array = infos[fn]
except KeyError:
# Calculate priorities for each file
matched = set()
for p in pkgfns:
- realfn, cls = bb.cache.Cache.virtualfn2realfn(p)
+ realfn, cls = bb.cache.virtualfn2realfn(p)
priorities[p] = self.calc_bbfile_priority(realfn, matched)
# Don't show the warning if the BBFILE_PATTERN did match .bbappend files
if len(allproviders[p]) > 1 or not show_multi_provider_only:
pref = preferred_versions[p]
- realfn = bb.cache.Cache.virtualfn2realfn(pref[1])
+ realfn = bb.cache.virtualfn2realfn(pref[1])
preffile = realfn[0]
# We only display once per recipe, we should prefer non extended versions of the
same_ver = True
provs = []
for prov in allproviders[p]:
- provfile = bb.cache.Cache.virtualfn2realfn(prov[1])[0]
+ provfile = bb.cache.virtualfn2realfn(prov[1])[0]
provlayer = self.get_file_layer(provfile)
provs.append((provfile, provlayer, prov[0]))
if provlayer != preflayer:
def get_appends_for_files(self, filenames):
appended, notappended = [], []
for filename in filenames:
- _, cls = bb.cache.Cache.virtualfn2realfn(filename)
+ _, cls = bb.cache.virtualfn2realfn(filename)
if cls:
continue
# The bb's DEPENDS and RDEPENDS
for f in pkg_fn:
- f = bb.cache.Cache.virtualfn2realfn(f)[0]
+ f = bb.cache.virtualfn2realfn(f)[0]
# Get the layername that the file is in
layername = self.get_file_layer(f)
def check_cross_depends(self, keyword, layername, f, needed_file, show_filenames, ignore_layers):
"""Print the DEPENDS/RDEPENDS file that crosses a layer boundary"""
- best_realfn = bb.cache.Cache.virtualfn2realfn(needed_file)[0]
+ best_realfn = bb.cache.virtualfn2realfn(needed_file)[0]
needed_layername = self.get_file_layer(best_realfn)
if needed_layername != layername and not needed_layername in ignore_layers:
if not show_filenames: