]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: cooker: Improve inotify overflow handling
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 9 Aug 2017 11:57:57 +0000 (12:57 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 13 Aug 2017 08:28:14 +0000 (09:28 +0100)
Add a proper function for clearing the mtime cache. Clean up the inotify
event overflow case to err on the side of caution and clear any potentially
now out of sync caches.

(Bitbake rev: ec60459fe2ba16966544eebff43b061abb7ed3ba)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/cooker.py
bitbake/lib/bb/parse/__init__.py

index 77b7f3dde1f8e76ff7158f264e59e23b592edfe0..b3d6cd9e34518520fff87fef4ab400c733f6133f 100644 (file)
@@ -189,7 +189,7 @@ class BBCooker:
 
         # If being called by something like tinfoil, we need to clean cached data
         # which may now be invalid
-        bb.parse.__mtime_cache = {}
+        bb.parse.clear_cache()
         bb.parse.BBHandler.cached_statements = {}
 
         self.ui_cmdline = None
@@ -247,7 +247,9 @@ class BBCooker:
     def config_notifications(self, event):
         if event.maskname == "IN_Q_OVERFLOW":
             bb.warn("inotify event queue overflowed, invalidating caches.")
+            self.parsecache_valid = False
             self.baseconfig_valid = False
+            bb.parse.clear_cache()
             return
         if not event.pathname in self.configwatcher.bbwatchedfiles:
             return
@@ -259,6 +261,7 @@ class BBCooker:
         if event.maskname == "IN_Q_OVERFLOW":
             bb.warn("inotify event queue overflowed, invalidating caches.")
             self.parsecache_valid = False
+            bb.parse.clear_cache()
             return
         if not event.pathname in self.inotify_modified_files:
             self.inotify_modified_files.append(event.pathname)
index a2952ecc0f2ba6ce2bc0d914f7632cae0ef1d132..2fc4002db51b04c4b9e7ce6c379f2e68f96cdaa6 100644 (file)
@@ -84,6 +84,10 @@ def update_cache(f):
         logger.debug(1, "Updating mtime cache for %s" % f)
         update_mtime(f)
 
+def clear_cache():
+    global __mtime_cache
+    __mtime_cache = {}
+
 def mark_dependency(d, f):
     if f.startswith('./'):
         f = "%s/%s" % (os.getcwd(), f[2:])