summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/command.py9
-rw-r--r--bitbake/lib/bb/cooker.py17
-rw-r--r--bitbake/lib/bb/server/process.py38
3 files changed, 37 insertions, 27 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 4d152ff4c0..d4dcc653a0 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -54,13 +54,20 @@ class Command:
54 self.cooker = cooker 54 self.cooker = cooker
55 self.cmds_sync = CommandsSync() 55 self.cmds_sync = CommandsSync()
56 self.cmds_async = CommandsAsync() 56 self.cmds_async = CommandsAsync()
57 self.remotedatastores = bb.remotedata.RemoteDatastores(cooker) 57 self.remotedatastores = None
58 58
59 # FIXME Add lock for this 59 # FIXME Add lock for this
60 self.currentAsyncCommand = None 60 self.currentAsyncCommand = None
61 61
62 def runCommand(self, commandline, ro_only = False): 62 def runCommand(self, commandline, ro_only = False):
63 command = commandline.pop(0) 63 command = commandline.pop(0)
64
65 # Ensure cooker is ready for commands
66 if command != "updateConfig" and command != "setFeatures":
67 self.cooker.init_configdata()
68 if not self.remotedatastores:
69 self.remotedatastores = bb.remotedata.RemoteDatastores(self.cooker)
70
64 if hasattr(CommandsSync, command): 71 if hasattr(CommandsSync, command):
65 # Can run synchronous commands straight away 72 # Can run synchronous commands straight away
66 command_method = getattr(self.cmds_sync, command) 73 command_method = getattr(self.cmds_sync, command)
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 3f351cbea6..3f9cb75434 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -195,11 +195,6 @@ class BBCooker:
195 self.hashserv = None 195 self.hashserv = None
196 self.hashservaddr = None 196 self.hashservaddr = None
197 197
198 self.initConfigurationData()
199
200 bb.debug(1, "BBCooker parsed base configuration %s" % time.time())
201 sys.stdout.flush()
202
203 self.inotify_modified_files = [] 198 self.inotify_modified_files = []
204 199
205 def _process_inotify_updates(server, cooker, abort): 200 def _process_inotify_updates(server, cooker, abort):
@@ -233,6 +228,13 @@ class BBCooker:
233 bb.debug(1, "BBCooker startup complete %s" % time.time()) 228 bb.debug(1, "BBCooker startup complete %s" % time.time())
234 sys.stdout.flush() 229 sys.stdout.flush()
235 230
231 def init_configdata(self):
232 if not hasattr(self, "data"):
233 self.initConfigurationData()
234 bb.debug(1, "BBCooker parsed base configuration %s" % time.time())
235 sys.stdout.flush()
236 self.handlePRServ()
237
236 def process_inotify_updates(self): 238 def process_inotify_updates(self):
237 for n in [self.confignotifier, self.notifier]: 239 for n in [self.confignotifier, self.notifier]:
238 if n.check_events(timeout=0): 240 if n.check_events(timeout=0):
@@ -318,7 +320,7 @@ class BBCooker:
318 for feature in features: 320 for feature in features:
319 self.featureset.setFeature(feature) 321 self.featureset.setFeature(feature)
320 bb.debug(1, "Features set %s (was %s)" % (original_featureset, list(self.featureset))) 322 bb.debug(1, "Features set %s (was %s)" % (original_featureset, list(self.featureset)))
321 if (original_featureset != list(self.featureset)) and self.state != state.error: 323 if (original_featureset != list(self.featureset)) and self.state != state.error and hasattr(self, "data"):
322 self.reset() 324 self.reset()
323 325
324 def initConfigurationData(self): 326 def initConfigurationData(self):
@@ -1658,9 +1660,6 @@ class BBCooker:
1658 return pkgs_to_build 1660 return pkgs_to_build
1659 1661
1660 def pre_serve(self): 1662 def pre_serve(self):
1661 # We now are in our own process so we can call this here.
1662 # PRServ exits if its parent process exits
1663 self.handlePRServ()
1664 return 1663 return
1665 1664
1666 def post_serve(self): 1665 def post_serve(self):
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 65e1eab527..b037e0fb6c 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -58,6 +58,7 @@ class ProcessServer():
58 self.sockname = sockname 58 self.sockname = sockname
59 59
60 self.server_timeout = server_timeout 60 self.server_timeout = server_timeout
61 self.timeout = self.server_timeout
61 self.xmlrpcinterface = xmlrpcinterface 62 self.xmlrpcinterface = xmlrpcinterface
62 63
63 def register_idle_function(self, function, data): 64 def register_idle_function(self, function, data):
@@ -72,21 +73,6 @@ class ProcessServer():
72 73
73 print("Bitbake XMLRPC server address: %s, server port: %s" % (self.xmlrpc.host, self.xmlrpc.port)) 74 print("Bitbake XMLRPC server address: %s, server port: %s" % (self.xmlrpc.host, self.xmlrpc.port))
74 75
75 heartbeat_event = self.cooker.data.getVar('BB_HEARTBEAT_EVENT')
76 if heartbeat_event:
77 try:
78 self.heartbeat_seconds = float(heartbeat_event)
79 except:
80 bb.warn('Ignoring invalid BB_HEARTBEAT_EVENT=%s, must be a float specifying seconds.' % heartbeat_event)
81
82 self.timeout = self.server_timeout or self.cooker.data.getVar('BB_SERVER_TIMEOUT')
83 try:
84 if self.timeout:
85 self.timeout = float(self.timeout)
86 except:
87 bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout)
88
89
90 try: 76 try:
91 self.bitbake_lock.seek(0) 77 self.bitbake_lock.seek(0)
92 self.bitbake_lock.truncate() 78 self.bitbake_lock.truncate()
@@ -129,6 +115,7 @@ class ProcessServer():
129 fds = [self.sock] 115 fds = [self.sock]
130 if self.xmlrpc: 116 if self.xmlrpc:
131 fds.append(self.xmlrpc) 117 fds.append(self.xmlrpc)
118 seendata = False
132 print("Entering server connection loop") 119 print("Entering server connection loop")
133 120
134 def disconnect_client(self, fds): 121 def disconnect_client(self, fds):
@@ -228,6 +215,22 @@ class ProcessServer():
228 if self.xmlrpc in ready: 215 if self.xmlrpc in ready:
229 self.xmlrpc.handle_requests() 216 self.xmlrpc.handle_requests()
230 217
218 if not seendata and hasattr(self.cooker, "data"):
219 heartbeat_event = self.cooker.data.getVar('BB_HEARTBEAT_EVENT')
220 if heartbeat_event:
221 try:
222 self.heartbeat_seconds = float(heartbeat_event)
223 except:
224 bb.warn('Ignoring invalid BB_HEARTBEAT_EVENT=%s, must be a float specifying seconds.' % heartbeat_event)
225
226 self.timeout = self.server_timeout or self.cooker.data.getVar('BB_SERVER_TIMEOUT')
227 try:
228 if self.timeout:
229 self.timeout = float(self.timeout)
230 except:
231 bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout)
232 seendata = True
233
231 ready = self.idle_commands(.1, fds) 234 ready = self.idle_commands(.1, fds)
232 235
233 print("Exiting") 236 print("Exiting")
@@ -323,8 +326,9 @@ class ProcessServer():
323 self.next_heartbeat += self.heartbeat_seconds 326 self.next_heartbeat += self.heartbeat_seconds
324 if self.next_heartbeat <= now: 327 if self.next_heartbeat <= now:
325 self.next_heartbeat = now + self.heartbeat_seconds 328 self.next_heartbeat = now + self.heartbeat_seconds
326 heartbeat = bb.event.HeartbeatEvent(now) 329 if hasattr(self.cooker, "data"):
327 bb.event.fire(heartbeat, self.cooker.data) 330 heartbeat = bb.event.HeartbeatEvent(now)
331 bb.event.fire(heartbeat, self.cooker.data)
328 if nextsleep and now + nextsleep > self.next_heartbeat: 332 if nextsleep and now + nextsleep > self.next_heartbeat:
329 # Shorten timeout so that we we wake up in time for 333 # Shorten timeout so that we we wake up in time for
330 # the heartbeat. 334 # the heartbeat.