diff mbox series

[3/3] cache: Drop support for not saving the cache file

Message ID 20221117152928.2738113-3-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 063ffe699bc5fc23174643dfedb66864cacfcff8
Headers show
Series [1/3] server: Ensure cooker profiling works | expand

Commit Message

Richard Purdie Nov. 17, 2022, 3:29 p.m. UTC
We don't test not using the cache and I'm not aware of anyone using this, it
would be hard to with modern bitbake.

Drop the conditional code and simply error if CACHE isn't set.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/cache.py | 28 +---------------------------
 1 file changed, 1 insertion(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index 22ed3e80be..cb6cf21727 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -309,20 +309,12 @@  class Cache(object):
         self.filelist_regex = re.compile(r'(?:(?<=:True)|(?<=:False))\s+')
 
         if self.cachedir in [None, '']:
-            self.has_cache = False
-            self.logger.info("Not using a cache. "
-                             "Set CACHE = <directory> to enable.")
-            return
-
-        self.has_cache = True
+            bb.fatal("Please ensure CACHE is set to the cache directory for BitBake to use")
 
     def getCacheFile(self, cachefile):
         return getCacheFile(self.cachedir, cachefile, self.mc, self.data_hash)
 
     def prepare_cache(self, progress):
-        if not self.has_cache:
-            return 0
-
         loaded = 0
 
         self.cachefile = self.getCacheFile("bb_cache.dat")
@@ -361,9 +353,6 @@  class Cache(object):
         return loaded
 
     def cachesize(self):
-        if not self.has_cache:
-            return 0
-
         cachesize = 0
         for cache_class in self.caches_array:
             cachefile = self.getCacheFile(cache_class.cachefile)
@@ -472,10 +461,6 @@  class Cache(object):
         """
         if fn not in self.checked:
             self.cacheValidUpdate(fn, appends)
-
-        # Is cache enabled?
-        if not self.has_cache:
-            return False
         if fn in self.clean:
             return True
         return False
@@ -485,10 +470,6 @@  class Cache(object):
         Is the cache valid for fn?
         Make thorough (slower) checks including timestamps.
         """
-        # Is cache enabled?
-        if not self.has_cache:
-            return False
-
         self.checked.add(fn)
 
         # File isn't in depends_cache
@@ -595,10 +576,6 @@  class Cache(object):
         Save the cache
         Called from the parser when complete (or exiting)
         """
-
-        if not self.has_cache:
-            return
-
         if self.cacheclean:
             self.logger.debug2("Cache is clean, not saving.")
             return
@@ -641,9 +618,6 @@  class Cache(object):
             if watcher:
                 watcher(info_array[0].file_depends)
 
-        if not self.has_cache:
-            return
-
         if (info_array[0].skipped or 'SRCREVINACTION' not in info_array[0].pv) and not info_array[0].nocache:
             if parsed:
                 self.cacheclean = False