diff options
Diffstat (limited to 'poky/bitbake/lib/bb/cooker.py')
-rw-r--r-- | poky/bitbake/lib/bb/cooker.py | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/poky/bitbake/lib/bb/cooker.py b/poky/bitbake/lib/bb/cooker.py index df4acca18a..08593d114a 100644 --- a/poky/bitbake/lib/bb/cooker.py +++ b/poky/bitbake/lib/bb/cooker.py @@ -169,27 +169,15 @@ class BBCooker: bb.debug(1, "BBCooker starting %s" % time.time()) sys.stdout.flush() - self.configwatcher = pyinotify.WatchManager() - bb.debug(1, "BBCooker pyinotify1 %s" % time.time()) - sys.stdout.flush() + self.configwatcher = None + self.confignotifier = None - self.configwatcher.bbseen = set() - self.configwatcher.bbwatchedfiles = set() - self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications) - bb.debug(1, "BBCooker pyinotify2 %s" % time.time()) - sys.stdout.flush() self.watchmask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CREATE | pyinotify.IN_DELETE | \ pyinotify.IN_DELETE_SELF | pyinotify.IN_MODIFY | pyinotify.IN_MOVE_SELF | \ pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO - self.watcher = pyinotify.WatchManager() - bb.debug(1, "BBCooker pyinotify3 %s" % time.time()) - sys.stdout.flush() - self.watcher.bbseen = set() - self.watcher.bbwatchedfiles = set() - self.notifier = pyinotify.Notifier(self.watcher, self.notifications) - bb.debug(1, "BBCooker pyinotify complete %s" % time.time()) - sys.stdout.flush() + self.watcher = None + self.notifier = None # If being called by something like tinfoil, we need to clean cached data # which may now be invalid @@ -240,9 +228,29 @@ class BBCooker: sys.stdout.flush() self.handlePRServ() + def setupConfigWatcher(self): + if self.configwatcher: + self.configwatcher.close() + self.confignotifier = None + self.configwatcher = None + self.configwatcher = pyinotify.WatchManager() + self.configwatcher.bbseen = set() + self.configwatcher.bbwatchedfiles = set() + self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications) + + def setupParserWatcher(self): + if self.watcher: + self.watcher.close() + self.notifier = None + self.watcher = None + self.watcher = pyinotify.WatchManager() + self.watcher.bbseen = set() + self.watcher.bbwatchedfiles = set() + self.notifier = pyinotify.Notifier(self.watcher, self.notifications) + def process_inotify_updates(self): for n in [self.confignotifier, self.notifier]: - if n.check_events(timeout=0): + if n and n.check_events(timeout=0): # read notified events and enqeue them n.read_events() n.process_events() @@ -262,10 +270,6 @@ class BBCooker: self.configwatcher.bbseen.remove(event.pathname) # Could remove all entries starting with the directory but for now... bb.parse.clear_cache() - if "IN_CREATE" in event.maskname: - self.add_filewatch([[event.pathname]], watcher=self.configwatcher, dirs=True) - elif "IN_DELETE" in event.maskname and event.pathname in self.configwatcher.bbseen: - self.configwatcher.bbseen.remove(event.pathname) if not event.pathname in self.inotify_modified_files: self.inotify_modified_files.append(event.pathname) self.baseconfig_valid = False @@ -285,10 +289,6 @@ class BBCooker: self.watcher.bbseen.remove(event.pathname) # Could remove all entries starting with the directory but for now... bb.parse.clear_cache() - if "IN_CREATE" in event.maskname: - self.add_filewatch([[event.pathname]], dirs=True) - elif "IN_DELETE" in event.maskname and event.pathname in self.watcher.bbseen: - self.watcher.bbseen.remove(event.pathname) if not event.pathname in self.inotify_modified_files: self.inotify_modified_files.append(event.pathname) self.parsecache_valid = False @@ -358,6 +358,8 @@ class BBCooker: if mod not in self.orig_sysmodules: del sys.modules[mod] + self.setupConfigWatcher() + # Need to preserve BB_CONSOLELOG over resets consolelog = None if hasattr(self, "data"): @@ -1639,6 +1641,8 @@ class BBCooker: self.updateCacheSync() if self.state != state.parsing and not self.parsecache_valid: + self.setupParserWatcher() + bb.parse.siggen.reset(self.data) self.parseConfiguration () if CookerFeatures.SEND_SANITYEVENTS in self.featureset: |