summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-10 15:57:03 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-11 16:21:47 +0100
commit542d9770f28cff298368263dd55f4c6e7bdbfb5c (patch)
tree75c8ff3455416fcb0bd8b0110ace1234f548a539
parent13cb1aea8ca1c34d6f180a38ab4a1a51fc1cf4ef (diff)
downloadpoky-542d9770f28cff298368263dd55f4c6e7bdbfb5c.tar.gz
poky-542d9770f28cff298368263dd55f4c6e7bdbfb5c.tar.bz2
poky-542d9770f28cff298368263dd55f4c6e7bdbfb5c.zip
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>
-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 b5a5281c0e..614d47d16f 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -176,9 +176,23 @@ class BBCooker:
bb.parse.update_cache(event.path)
self.parsecache_valid = False
- def add_filewatch(self, deps):
+ def add_filewatch(self, deps, watcher=None):
+ if not watcher:
+ watcher = self.watcher
for i in deps:
- self.watcher.add_watch(i[0], self.watchmask, rec=True)
+ f = i[0]
+ while True:
+ # 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.
+ try:
+ watcher.add_watch(f, self.watchmask, quiet=False)
+ break
+ except pyinotify.WatchManagerError as e:
+ if 'ENOENT' in str(e):
+ f = os.path.dirname(f)
+ continue
+ raise
def sigterm_exception(self, signum, stackframe):
if signum == signal.SIGTERM:
@@ -1342,8 +1356,7 @@ class BBCooker:
(filelist, masked) = self.collection.collect_bbfiles(self.data, self.event_data)
self.data.renameVar("__depends", "__base_depends")
- for i in self.data.getVar("__base_depends"):
- self.wdd = self.configwatcher.add_watch(i[0], self.watchmask, rec=True)
+ self.add_filewatch(self.data.getVar("__base_depends"), self.configwatcher)
self.parser = CookerParser(self, filelist, masked)
self.parsecache_valid = True