summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-14 12:18:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-14 13:34:06 +0000
commiteb7480fc4d7ee1894465277425e13c8d1697a5e5 (patch)
tree259aed5d3bd6f748cd404501942c43f6751086c7 /bitbake/lib/bb/cooker.py
parent6c3c3e11f6f06f6ad9bf8fd2a026e03f76204ba4 (diff)
downloadpoky-eb7480fc4d7ee1894465277425e13c8d1697a5e5.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) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index f14eb64c83..d065b4dc4e 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:
@@ -1411,8 +1425,7 @@ class BBCooker:
1411 (filelist, masked) = self.collection.collect_bbfiles(self.data, self.event_data) 1425 (filelist, masked) = self.collection.collect_bbfiles(self.data, self.event_data)
1412 1426
1413 self.data.renameVar("__depends", "__base_depends") 1427 self.data.renameVar("__depends", "__base_depends")
1414 for i in self.data.getVar("__base_depends"): 1428 self.add_filewatch(self.data.getVar("__base_depends"), self.configwatcher)
1415 self.wdd = self.configwatcher.add_watch(i[0], self.watchmask, rec=True)
1416 1429
1417 self.parser = CookerParser(self, filelist, masked) 1430 self.parser = CookerParser(self, filelist, masked)
1418 self.parsecache_valid = True 1431 self.parsecache_valid = True