summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cache.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r--bitbake/lib/bb/cache.py55
1 files changed, 25 insertions, 30 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 658f30ff59..c915bb93fc 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -244,7 +244,26 @@ class CoreRecipeInfo(RecipeInfoCommon):
244 cachedata.fakerootdirs[fn] = self.fakerootdirs 244 cachedata.fakerootdirs[fn] = self.fakerootdirs
245 cachedata.extradepsfunc[fn] = self.extradepsfunc 245 cachedata.extradepsfunc[fn] = self.extradepsfunc
246 246
247def virtualfn2realfn(virtualfn):
248 """
249 Convert a virtual file name to a real one + the associated subclass keyword
250 """
247 251
252 fn = virtualfn
253 cls = ""
254 if virtualfn.startswith('virtual:'):
255 elems = virtualfn.split(':')
256 cls = ":".join(elems[1:-1])
257 fn = elems[-1]
258 return (fn, cls)
259
260def realfn2virtual(realfn, cls):
261 """
262 Convert a real filename + the associated subclass keyword to a virtual filename
263 """
264 if cls == "":
265 return realfn
266 return "virtual:" + cls + ":" + realfn
248 267
249class Cache(object): 268class Cache(object):
250 """ 269 """
@@ -355,30 +374,6 @@ class Cache(object):
355 len(self.depends_cache)), 374 len(self.depends_cache)),
356 self.data) 375 self.data)
357 376
358
359 @staticmethod
360 def virtualfn2realfn(virtualfn):
361 """
362 Convert a virtual file name to a real one + the associated subclass keyword
363 """
364
365 fn = virtualfn
366 cls = ""
367 if virtualfn.startswith('virtual:'):
368 elems = virtualfn.split(':')
369 cls = ":".join(elems[1:-1])
370 fn = elems[-1]
371 return (fn, cls)
372
373 @staticmethod
374 def realfn2virtual(realfn, cls):
375 """
376 Convert a real filename + the associated subclass keyword to a virtual filename
377 """
378 if cls == "":
379 return realfn
380 return "virtual:" + cls + ":" + realfn
381
382 @classmethod 377 @classmethod
383 def loadDataFull(cls, virtualfn, appends, cfgData): 378 def loadDataFull(cls, virtualfn, appends, cfgData):
384 """ 379 """
@@ -386,7 +381,7 @@ class Cache(object):
386 To do this, we need to parse the file. 381 To do this, we need to parse the file.
387 """ 382 """
388 383
389 (fn, virtual) = cls.virtualfn2realfn(virtualfn) 384 (fn, virtual) = virtualfn2realfn(virtualfn)
390 385
391 logger.debug(1, "Parsing %s (full)", fn) 386 logger.debug(1, "Parsing %s (full)", fn)
392 387
@@ -406,7 +401,7 @@ class Cache(object):
406 for variant, data in sorted(datastores.items(), 401 for variant, data in sorted(datastores.items(),
407 key=lambda i: i[0], 402 key=lambda i: i[0],
408 reverse=True): 403 reverse=True):
409 virtualfn = cls.realfn2virtual(filename, variant) 404 virtualfn = realfn2virtual(filename, variant)
410 variants.append(variant) 405 variants.append(variant)
411 depends = depends + (data.getVar("__depends", False) or []) 406 depends = depends + (data.getVar("__depends", False) or [])
412 if depends and not variant: 407 if depends and not variant:
@@ -435,7 +430,7 @@ class Cache(object):
435 # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo] 430 # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo]
436 info_array = self.depends_cache[filename] 431 info_array = self.depends_cache[filename]
437 for variant in info_array[0].variants: 432 for variant in info_array[0].variants:
438 virtualfn = self.realfn2virtual(filename, variant) 433 virtualfn = realfn2virtual(filename, variant)
439 infos.append((virtualfn, self.depends_cache[virtualfn])) 434 infos.append((virtualfn, self.depends_cache[virtualfn]))
440 else: 435 else:
441 return self.parse(filename, appends, configdata, self.caches_array) 436 return self.parse(filename, appends, configdata, self.caches_array)
@@ -556,7 +551,7 @@ class Cache(object):
556 551
557 invalid = False 552 invalid = False
558 for cls in info_array[0].variants: 553 for cls in info_array[0].variants:
559 virtualfn = self.realfn2virtual(fn, cls) 554 virtualfn = realfn2virtual(fn, cls)
560 self.clean.add(virtualfn) 555 self.clean.add(virtualfn)
561 if virtualfn not in self.depends_cache: 556 if virtualfn not in self.depends_cache:
562 logger.debug(2, "Cache: %s is not cached", virtualfn) 557 logger.debug(2, "Cache: %s is not cached", virtualfn)
@@ -568,7 +563,7 @@ class Cache(object):
568 # If any one of the variants is not present, mark as invalid for all 563 # If any one of the variants is not present, mark as invalid for all
569 if invalid: 564 if invalid:
570 for cls in info_array[0].variants: 565 for cls in info_array[0].variants:
571 virtualfn = self.realfn2virtual(fn, cls) 566 virtualfn = realfn2virtual(fn, cls)
572 if virtualfn in self.clean: 567 if virtualfn in self.clean:
573 logger.debug(2, "Cache: Removing %s from cache", virtualfn) 568 logger.debug(2, "Cache: Removing %s from cache", virtualfn)
574 self.clean.remove(virtualfn) 569 self.clean.remove(virtualfn)
@@ -645,7 +640,7 @@ class Cache(object):
645 Save data we need into the cache 640 Save data we need into the cache
646 """ 641 """
647 642
648 realfn = self.virtualfn2realfn(file_name)[0] 643 realfn = virtualfn2realfn(file_name)[0]
649 644
650 info_array = [] 645 info_array = []
651 for cache_class in self.caches_array: 646 for cache_class in self.caches_array: