summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/cache.py55
-rw-r--r--bitbake/lib/bb/cooker.py10
2 files changed, 30 insertions, 35 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:
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index d4dd23f09c..11c611de72 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -601,9 +601,9 @@ class BBCooker:
601 # this showEnvironment() code path doesn't use the cache 601 # this showEnvironment() code path doesn't use the cache
602 self.parseConfiguration() 602 self.parseConfiguration()
603 603
604 fn, cls = bb.cache.Cache.virtualfn2realfn(buildfile) 604 fn, cls = bb.cache.virtualfn2realfn(buildfile)
605 fn = self.matchFile(fn) 605 fn = self.matchFile(fn)
606 fn = bb.cache.Cache.realfn2virtual(fn, cls) 606 fn = bb.cache.realfn2virtual(fn, cls)
607 elif len(pkgs_to_build) == 1: 607 elif len(pkgs_to_build) == 1:
608 ignore = self.expanded_data.getVar("ASSUME_PROVIDED", True) or "" 608 ignore = self.expanded_data.getVar("ASSUME_PROVIDED", True) or ""
609 if pkgs_to_build[0] in set(ignore.split()): 609 if pkgs_to_build[0] in set(ignore.split()):
@@ -1249,7 +1249,7 @@ class BBCooker:
1249 if (task == None): 1249 if (task == None):
1250 task = self.configuration.cmd 1250 task = self.configuration.cmd
1251 1251
1252 fn, cls = bb.cache.Cache.virtualfn2realfn(buildfile) 1252 fn, cls = bb.cache.virtualfn2realfn(buildfile)
1253 fn = self.matchFile(fn) 1253 fn = self.matchFile(fn)
1254 1254
1255 self.buildSetVars() 1255 self.buildSetVars()
@@ -1259,7 +1259,7 @@ class BBCooker:
1259 self.caches_array) 1259 self.caches_array)
1260 infos = dict(infos) 1260 infos = dict(infos)
1261 1261
1262 fn = bb.cache.Cache.realfn2virtual(fn, cls) 1262 fn = bb.cache.realfn2virtual(fn, cls)
1263 try: 1263 try:
1264 info_array = infos[fn] 1264 info_array = infos[fn]
1265 except KeyError: 1265 except KeyError:
@@ -1822,7 +1822,7 @@ class CookerCollectFiles(object):
1822 # Calculate priorities for each file 1822 # Calculate priorities for each file
1823 matched = set() 1823 matched = set()
1824 for p in pkgfns: 1824 for p in pkgfns:
1825 realfn, cls = bb.cache.Cache.virtualfn2realfn(p) 1825 realfn, cls = bb.cache.virtualfn2realfn(p)
1826 priorities[p] = self.calc_bbfile_priority(realfn, matched) 1826 priorities[p] = self.calc_bbfile_priority(realfn, matched)
1827 1827
1828 # Don't show the warning if the BBFILE_PATTERN did match .bbappend files 1828 # Don't show the warning if the BBFILE_PATTERN did match .bbappend files