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.py35
1 files changed, 13 insertions, 22 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 18d5574a31..2361c5684d 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -28,7 +28,7 @@ import shutil
28 28
29logger = logging.getLogger("BitBake.Cache") 29logger = logging.getLogger("BitBake.Cache")
30 30
31__cache_version__ = "155" 31__cache_version__ = "156"
32 32
33def getCacheFile(path, filename, mc, data_hash): 33def getCacheFile(path, filename, mc, data_hash):
34 mcspec = '' 34 mcspec = ''
@@ -395,7 +395,7 @@ class Cache(object):
395 # It will be used later for deciding whether we 395 # It will be used later for deciding whether we
396 # need extra cache file dump/load support 396 # need extra cache file dump/load support
397 self.mc = mc 397 self.mc = mc
398 self.logger = PrefixLoggerAdapter("Cache: %s: " % (mc if mc else "default"), logger) 398 self.logger = PrefixLoggerAdapter("Cache: %s: " % (mc if mc else ''), logger)
399 self.caches_array = caches_array 399 self.caches_array = caches_array
400 self.cachedir = self.data.getVar("CACHE") 400 self.cachedir = self.data.getVar("CACHE")
401 self.clean = set() 401 self.clean = set()
@@ -441,7 +441,7 @@ class Cache(object):
441 else: 441 else:
442 symlink = os.path.join(self.cachedir, "bb_cache.dat") 442 symlink = os.path.join(self.cachedir, "bb_cache.dat")
443 443
444 if os.path.exists(symlink): 444 if os.path.exists(symlink) or os.path.islink(symlink):
445 bb.utils.remove(symlink) 445 bb.utils.remove(symlink)
446 try: 446 try:
447 os.symlink(os.path.basename(self.cachefile), symlink) 447 os.symlink(os.path.basename(self.cachefile), symlink)
@@ -779,25 +779,6 @@ class MulticonfigCache(Mapping):
779 for k in self.__caches: 779 for k in self.__caches:
780 yield k 780 yield k
781 781
782def init(cooker):
783 """
784 The Objective: Cache the minimum amount of data possible yet get to the
785 stage of building packages (i.e. tryBuild) without reparsing any .bb files.
786
787 To do this, we intercept getVar calls and only cache the variables we see
788 being accessed. We rely on the cache getVar calls being made for all
789 variables bitbake might need to use to reach this stage. For each cached
790 file we need to track:
791
792 * Its mtime
793 * The mtimes of all its dependencies
794 * Whether it caused a parse.SkipRecipe exception
795
796 Files causing parsing errors are evicted from the cache.
797
798 """
799 return Cache(cooker.configuration.data, cooker.configuration.data_hash)
800
801 782
802class CacheData(object): 783class CacheData(object):
803 """ 784 """
@@ -866,6 +847,16 @@ class MultiProcessCache(object):
866 data = [{}] 847 data = [{}]
867 return data 848 return data
868 849
850 def clear_cache(self):
851 if not self.cachefile:
852 bb.fatal("Can't clear invalid cachefile")
853
854 self.cachedata = self.create_cachedata()
855 self.cachedata_extras = self.create_cachedata()
856 with bb.utils.fileslocked([self.cachefile + ".lock"]):
857 bb.utils.remove(self.cachefile)
858 bb.utils.remove(self.cachefile + "-*")
859
869 def save_extras(self): 860 def save_extras(self):
870 if not self.cachefile: 861 if not self.cachefile:
871 return 862 return