diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-14 09:11:24 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-15 16:48:12 +0000 |
commit | 7593756cbb28bb3c09f6192d22b73ff8b6572638 (patch) | |
tree | c49987ec0c77433bb56c0589df55bdf05f3649bc /bitbake | |
parent | 9cb38c1eb54a37ca846585e305f6e85b1db041c8 (diff) | |
download | poky-7593756cbb28bb3c09f6192d22b73ff8b6572638.tar.gz |
bitbake: cooker: Improve cache handling
We're seeing issues where the self test, which uses tinfoil doesn't
notice the changed contents of include files. The issue is
cached_statements in the parser being reused when the files have changed.
Whilst looking at this, I realised there were some other issues:
* We need to also invalidate the mtime cache when cooker restarts
* We should pass full filenames to the file invalidation code
* We should process cached_statements as part of inotify invalidation
With these fixes, the caching is more reliable for memory resident
bitbake too. It does raise some questions about cache validation and
lifecycles and indicates bitbake does need more work in the area,
preferably with the removal of the globals. This at least highlights
and works around some of the current issues.
(Bitbake rev: 3f507ff8bc467fba936cf3f31bb8ea8e02f168e8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 43e9f18018..b4486f3078 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -144,6 +144,10 @@ class BBCooker: | |||
144 | self.watcher.bbwatchedfiles = [] | 144 | self.watcher.bbwatchedfiles = [] |
145 | self.notifier = pyinotify.Notifier(self.watcher, self.notifications) | 145 | self.notifier = pyinotify.Notifier(self.watcher, self.notifications) |
146 | 146 | ||
147 | # If being called by something like tinfoil, we need to clean cached data | ||
148 | # which may now be invalid | ||
149 | bb.parse.__mtime_cache = {} | ||
150 | bb.parse.BBHandler.cached_statements = {} | ||
147 | 151 | ||
148 | self.initConfigurationData() | 152 | self.initConfigurationData() |
149 | 153 | ||
@@ -197,13 +201,13 @@ class BBCooker: | |||
197 | def config_notifications(self, event): | 201 | def config_notifications(self, event): |
198 | if not event.pathname in self.configwatcher.bbwatchedfiles: | 202 | if not event.pathname in self.configwatcher.bbwatchedfiles: |
199 | return | 203 | return |
200 | if not event.path in self.inotify_modified_files: | 204 | if not event.pathname in self.inotify_modified_files: |
201 | self.inotify_modified_files.append(event.path) | 205 | self.inotify_modified_files.append(event.pathname) |
202 | self.baseconfig_valid = False | 206 | self.baseconfig_valid = False |
203 | 207 | ||
204 | def notifications(self, event): | 208 | def notifications(self, event): |
205 | if not event.path in self.inotify_modified_files: | 209 | if not event.pathname in self.inotify_modified_files: |
206 | self.inotify_modified_files.append(event.path) | 210 | self.inotify_modified_files.append(event.pathname) |
207 | self.parsecache_valid = False | 211 | self.parsecache_valid = False |
208 | 212 | ||
209 | def add_filewatch(self, deps, watcher=None): | 213 | def add_filewatch(self, deps, watcher=None): |
@@ -1505,6 +1509,8 @@ class BBCooker: | |||
1505 | # reload files for which we got notifications | 1509 | # reload files for which we got notifications |
1506 | for p in self.inotify_modified_files: | 1510 | for p in self.inotify_modified_files: |
1507 | bb.parse.update_cache(p) | 1511 | bb.parse.update_cache(p) |
1512 | if p in bb.parse.BBHandler.cached_statements: | ||
1513 | del bb.parse.BBHandler.cached_statements[p] | ||
1508 | self.inotify_modified_files = [] | 1514 | self.inotify_modified_files = [] |
1509 | 1515 | ||
1510 | if not self.baseconfig_valid: | 1516 | if not self.baseconfig_valid: |