diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-10 15:57:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-11 16:21:47 +0100 |
commit | 542d9770f28cff298368263dd55f4c6e7bdbfb5c (patch) | |
tree | 75c8ff3455416fcb0bd8b0110ace1234f548a539 /bitbake/lib/bb | |
parent | 13cb1aea8ca1c34d6f180a38ab4a1a51fc1cf4ef (diff) | |
download | poky-542d9770f28cff298368263dd55f4c6e7bdbfb5c.tar.gz |
bitbake: cooker: Fix pyinotify handling of ENOENT issues
We try and add watches for files that don't exist but if they did, would influence
the parser. The parent directory of these files may not exist, in which case we need
to watch any parent that does exist for changes. This change implements that fallback
handling.
(Bitbake rev: 979ddbe4b7340d7cf2f432f6b1eba1c58d55ff42)
(Bitbake rev: 6d0abc6a5c9b8b37eecfa63fbcb5343162bc9311)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index b5a5281c0e..614d47d16f 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -176,9 +176,23 @@ class BBCooker: | |||
176 | bb.parse.update_cache(event.path) | 176 | bb.parse.update_cache(event.path) |
177 | self.parsecache_valid = False | 177 | self.parsecache_valid = False |
178 | 178 | ||
179 | def add_filewatch(self, deps): | 179 | def add_filewatch(self, deps, watcher=None): |
180 | if not watcher: | ||
181 | watcher = self.watcher | ||
180 | for i in deps: | 182 | for i in deps: |
181 | self.watcher.add_watch(i[0], self.watchmask, rec=True) | 183 | f = i[0] |
184 | while True: | ||
185 | # We try and add watches for files that don't exist but if they did, would influence | ||
186 | # the parser. The parent directory of these files may not exist, in which case we need | ||
187 | # to watch any parent that does exist for changes. | ||
188 | try: | ||
189 | watcher.add_watch(f, self.watchmask, quiet=False) | ||
190 | break | ||
191 | except pyinotify.WatchManagerError as e: | ||
192 | if 'ENOENT' in str(e): | ||
193 | f = os.path.dirname(f) | ||
194 | continue | ||
195 | raise | ||
182 | 196 | ||
183 | def sigterm_exception(self, signum, stackframe): | 197 | def sigterm_exception(self, signum, stackframe): |
184 | if signum == signal.SIGTERM: | 198 | if signum == signal.SIGTERM: |
@@ -1342,8 +1356,7 @@ class BBCooker: | |||
1342 | (filelist, masked) = self.collection.collect_bbfiles(self.data, self.event_data) | 1356 | (filelist, masked) = self.collection.collect_bbfiles(self.data, self.event_data) |
1343 | 1357 | ||
1344 | self.data.renameVar("__depends", "__base_depends") | 1358 | self.data.renameVar("__depends", "__base_depends") |
1345 | for i in self.data.getVar("__base_depends"): | 1359 | self.add_filewatch(self.data.getVar("__base_depends"), self.configwatcher) |
1346 | self.wdd = self.configwatcher.add_watch(i[0], self.watchmask, rec=True) | ||
1347 | 1360 | ||
1348 | self.parser = CookerParser(self, filelist, masked) | 1361 | self.parser = CookerParser(self, filelist, masked) |
1349 | self.parsecache_valid = True | 1362 | self.parsecache_valid = True |