bitbake: cooker: Further fixes to inotify to fix memres bitbake issues

The previous fix for inotify wasn't quite correct as we need to modify
bbseen before calling add_filewatch(). We also need to ensure the parse
mtime cache is cleared when directories are added/removed. There was also
a typo in the original fix and the wrong watcher was being changed. Fix
the various issues which improves memory resident bitbake testing results.

(Bitbake rev: 66cadd6be58bce5f7a56556cf92efd8159fb0b0e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-03-30 18:29:57 +01:00
parent 3fdbeb0895
commit fd1a6bad77

View File

@@ -254,9 +254,14 @@ class BBCooker:
if not event.pathname in self.configwatcher.bbwatchedfiles:
return
if "IN_ISDIR" in event.maskname:
if "IN_CREATE" in event.maskname or "IN_DELETE" in event.maskname:
if event.pathname in self.configwatcher.bbseen:
self.configwatcher.bbseen.remove(event.pathname)
# Could remove all entries starting with the directory but for now...
bb.parse.clear_cache()
if "IN_CREATE" in event.maskname:
self.add_filewatch([[event.pathname]], watcher=self.configwatcher, dirs=True)
elif "IN_DELETE" in event.maskname and event.pathname in self.watcher.bbseen:
elif "IN_DELETE" in event.maskname and event.pathname in self.configwatcher.bbseen:
self.configwatcher.bbseen.remove(event.pathname)
if not event.pathname in self.inotify_modified_files:
self.inotify_modified_files.append(event.pathname)
@@ -272,6 +277,11 @@ class BBCooker:
or event.pathname.endswith("bitbake.lock"):
return
if "IN_ISDIR" in event.maskname:
if "IN_CREATE" in event.maskname or "IN_DELETE" in event.maskname:
if event.pathname in self.watcher.bbseen:
self.watcher.bbseen.remove(event.pathname)
# Could remove all entries starting with the directory but for now...
bb.parse.clear_cache()
if "IN_CREATE" in event.maskname:
self.add_filewatch([[event.pathname]], dirs=True)
elif "IN_DELETE" in event.maskname and event.pathname in self.watcher.bbseen: