summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/cooker.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 84bf46b9ee..f0f9c66f4e 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -126,12 +126,14 @@ class BBCooker:
126 126
127 self.configwatcher = pyinotify.WatchManager() 127 self.configwatcher = pyinotify.WatchManager()
128 self.configwatcher.bbseen = [] 128 self.configwatcher.bbseen = []
129 self.configwatcher.bbwatchedfiles = []
129 self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications) 130 self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications)
130 self.watchmask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CREATE | pyinotify.IN_DELETE | \ 131 self.watchmask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CREATE | pyinotify.IN_DELETE | \
131 pyinotify.IN_DELETE_SELF | pyinotify.IN_MODIFY | pyinotify.IN_MOVE_SELF | \ 132 pyinotify.IN_DELETE_SELF | pyinotify.IN_MODIFY | pyinotify.IN_MOVE_SELF | \
132 pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO 133 pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO
133 self.watcher = pyinotify.WatchManager() 134 self.watcher = pyinotify.WatchManager()
134 self.watcher.bbseen = [] 135 self.watcher.bbseen = []
136 self.watcher.bbwatchedfiles = []
135 self.notifier = pyinotify.Notifier(self.watcher, self.notifications) 137 self.notifier = pyinotify.Notifier(self.watcher, self.notifications)
136 138
137 139
@@ -185,6 +187,8 @@ class BBCooker:
185 signal.signal(signal.SIGHUP, self.sigterm_exception) 187 signal.signal(signal.SIGHUP, self.sigterm_exception)
186 188
187 def config_notifications(self, event): 189 def config_notifications(self, event):
190 if not event.pathname in self.configwatcher.bbwatchedfiles:
191 return
188 if not event.path in self.inotify_modified_files: 192 if not event.path in self.inotify_modified_files:
189 self.inotify_modified_files.append(event.path) 193 self.inotify_modified_files.append(event.path)
190 self.baseconfig_valid = False 194 self.baseconfig_valid = False
@@ -198,20 +202,27 @@ class BBCooker:
198 if not watcher: 202 if not watcher:
199 watcher = self.watcher 203 watcher = self.watcher
200 for i in deps: 204 for i in deps:
205 watcher.bbwatchedfiles.append(i[0])
201 f = os.path.dirname(i[0]) 206 f = os.path.dirname(i[0])
202 if f in watcher.bbseen: 207 if f in watcher.bbseen:
203 continue 208 continue
204 watcher.bbseen.append(f) 209 watcher.bbseen.append(f)
210 watchtarget = None
205 while True: 211 while True:
206 # We try and add watches for files that don't exist but if they did, would influence 212 # We try and add watches for files that don't exist but if they did, would influence
207 # the parser. The parent directory of these files may not exist, in which case we need 213 # the parser. The parent directory of these files may not exist, in which case we need
208 # to watch any parent that does exist for changes. 214 # to watch any parent that does exist for changes.
209 try: 215 try:
210 watcher.add_watch(f, self.watchmask, quiet=False) 216 watcher.add_watch(f, self.watchmask, quiet=False)
217 if watchtarget:
218 watcher.bbwatchedfiles.append(watchtarget)
211 break 219 break
212 except pyinotify.WatchManagerError as e: 220 except pyinotify.WatchManagerError as e:
213 if 'ENOENT' in str(e): 221 if 'ENOENT' in str(e):
222 watchtarget = f
214 f = os.path.dirname(f) 223 f = os.path.dirname(f)
224 if f in watcher.bbseen:
225 break
215 watcher.bbseen.append(f) 226 watcher.bbseen.append(f)
216 continue 227 continue
217 if 'ENOSPC' in str(e): 228 if 'ENOSPC' in str(e):