From fd1a6bad77b008af28291567aa53776c644c3a48 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 30 Mar 2022 18:29:57 +0100 Subject: 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 --- bitbake/lib/bb/cooker.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index f435b18c87..1359d33f77 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -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: -- cgit v1.2.3-54-g00ecf