summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-02-23 19:24:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-09 14:33:43 +0000
commita9cd657a01ad1158427f9539220694e77de896a2 (patch)
tree0af2d1607dc23041077dd3fd01d14104b346bf98 /bitbake
parentc504276d260571da38a20ff9c58ffc2e0c760fbb (diff)
downloadpoky-a9cd657a01ad1158427f9539220694e77de896a2.tar.gz
bitbake: cooker: read file watches on server idle
The inotify facility monitoring changes to the config files could be overwhelmed by massive changes to the watched files while server is running. This patch adds verification the notification watches to the server idle functions, in addition to the cooker updateCache command which executes only infrequently, thus preventing overflowing the notification buffer. [YOCTO #7316] (Bitbake rev: 996e663fd5c254292f44eca46f5fdc95af897f98) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 0bbbc09c33..5ebf6a1328 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -133,6 +133,19 @@ class BBCooker:
133 133
134 134
135 self.initConfigurationData() 135 self.initConfigurationData()
136
137 self.inotify_modified_files = []
138
139 def _process_inotify_updates(server, notifier_list, abort):
140 for n in notifier_list:
141 if n.check_events(timeout=0):
142 # read notified events and enqeue them
143 n.read_events()
144 n.process_events()
145 return True
146
147 self.configuration.server_register_idlecallback(_process_inotify_updates, [self.confignotifier, self.notifier])
148
136 self.baseconfig_valid = True 149 self.baseconfig_valid = True
137 self.parsecache_valid = False 150 self.parsecache_valid = False
138 151
@@ -171,11 +184,13 @@ class BBCooker:
171 signal.signal(signal.SIGHUP, self.sigterm_exception) 184 signal.signal(signal.SIGHUP, self.sigterm_exception)
172 185
173 def config_notifications(self, event): 186 def config_notifications(self, event):
174 bb.parse.update_cache(event.path) 187 if not event.path in self.inotify_modified_files:
188 self.inotify_modified_files.append(event.path)
175 self.baseconfig_valid = False 189 self.baseconfig_valid = False
176 190
177 def notifications(self, event): 191 def notifications(self, event):
178 bb.parse.update_cache(event.path) 192 if not event.path in self.inotify_modified_files:
193 self.inotify_modified_files.append(event.path)
179 self.parsecache_valid = False 194 self.parsecache_valid = False
180 195
181 def add_filewatch(self, deps, watcher=None): 196 def add_filewatch(self, deps, watcher=None):
@@ -1419,11 +1434,12 @@ class BBCooker:
1419 raise bb.BBHandledException() 1434 raise bb.BBHandledException()
1420 1435
1421 if self.state != state.parsing: 1436 if self.state != state.parsing:
1422 for n in [self.confignotifier, self.notifier]: 1437
1423 if n.check_events(timeout=0): 1438 # reload files for which we got notifications
1424 # read notified events and enqeue them 1439 for p in self.inotify_modified_files:
1425 n.read_events() 1440 bb.parse.update_cache(p)
1426 n.process_events() 1441 self.inotify_modified_files = []
1442
1427 if not self.baseconfig_valid: 1443 if not self.baseconfig_valid:
1428 logger.debug(1, "Reloading base configuration data") 1444 logger.debug(1, "Reloading base configuration data")
1429 self.initConfigurationData() 1445 self.initConfigurationData()