summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-12-13 20:07:12 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-14 12:25:07 +0000
commit8d315820aa2c860bee05175a42360e549601a16f (patch)
treea6f9853e108c13d4c8512ae0e7a532d86ef6e776 /bitbake
parent7229250411e7517cdf9e464d7f6033b155811bd8 (diff)
downloadpoky-8d315820aa2c860bee05175a42360e549601a16f.tar.gz
bitbake: runqueue: enable setVariable command to affect task execution
Allow the client to set variables with the setVariable command and have those changes take effect when running tasks. This is accomplished by collecting changes made by setVariable separately and pass these to the worker so it can be applied on top of the datastore it creates. (Bitbake rev: 69a3cd790da35c3898a8f50c284ad1a4677682a4) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-worker12
-rw-r--r--bitbake/lib/bb/command.py1
-rw-r--r--bitbake/lib/bb/cooker.py1
-rw-r--r--bitbake/lib/bb/runqueue.py1
4 files changed, 13 insertions, 2 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index 97b32c3878..4dbd681172 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -136,7 +136,7 @@ def sigterm_handler(signum, frame):
136 os.killpg(0, signal.SIGTERM) 136 os.killpg(0, signal.SIGTERM)
137 sys.exit() 137 sys.exit()
138 138
139def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, appends, taskdepdata, quieterrors=False): 139def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, appends, taskdepdata, extraconfigdata, quieterrors=False):
140 # We need to setup the environment BEFORE the fork, since 140 # We need to setup the environment BEFORE the fork, since
141 # a fork() or exec*() activates PSEUDO... 141 # a fork() or exec*() activates PSEUDO...
142 142
@@ -223,6 +223,9 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, append
223 the_data.setVar("BUILDNAME", workerdata["buildname"]) 223 the_data.setVar("BUILDNAME", workerdata["buildname"])
224 the_data.setVar("DATE", workerdata["date"]) 224 the_data.setVar("DATE", workerdata["date"])
225 the_data.setVar("TIME", workerdata["time"]) 225 the_data.setVar("TIME", workerdata["time"])
226 for varname, value in extraconfigdata.items():
227 the_data.setVar(varname, value)
228
226 bb.parse.siggen.set_taskdata(workerdata["sigdata"]) 229 bb.parse.siggen.set_taskdata(workerdata["sigdata"])
227 ret = 0 230 ret = 0
228 231
@@ -329,6 +332,7 @@ class BitbakeWorker(object):
329 self.cookercfg = None 332 self.cookercfg = None
330 self.databuilder = None 333 self.databuilder = None
331 self.data = None 334 self.data = None
335 self.extraconfigdata = None
332 self.build_pids = {} 336 self.build_pids = {}
333 self.build_pipes = {} 337 self.build_pipes = {}
334 338
@@ -363,6 +367,7 @@ class BitbakeWorker(object):
363 pass 367 pass
364 if len(self.queue): 368 if len(self.queue):
365 self.handle_item(b"cookerconfig", self.handle_cookercfg) 369 self.handle_item(b"cookerconfig", self.handle_cookercfg)
370 self.handle_item(b"extraconfigdata", self.handle_extraconfigdata)
366 self.handle_item(b"workerdata", self.handle_workerdata) 371 self.handle_item(b"workerdata", self.handle_workerdata)
367 self.handle_item(b"runtask", self.handle_runtask) 372 self.handle_item(b"runtask", self.handle_runtask)
368 self.handle_item(b"finishnow", self.handle_finishnow) 373 self.handle_item(b"finishnow", self.handle_finishnow)
@@ -391,6 +396,9 @@ class BitbakeWorker(object):
391 self.databuilder.parseBaseConfiguration() 396 self.databuilder.parseBaseConfiguration()
392 self.data = self.databuilder.data 397 self.data = self.databuilder.data
393 398
399 def handle_extraconfigdata(self, data):
400 self.extraconfigdata = pickle.loads(data)
401
394 def handle_workerdata(self, data): 402 def handle_workerdata(self, data):
395 self.workerdata = pickle.loads(data) 403 self.workerdata = pickle.loads(data)
396 bb.msg.loggerDefaultDebugLevel = self.workerdata["logdefaultdebug"] 404 bb.msg.loggerDefaultDebugLevel = self.workerdata["logdefaultdebug"]
@@ -416,7 +424,7 @@ class BitbakeWorker(object):
416 fn, task, taskname, quieterrors, appends, taskdepdata = pickle.loads(data) 424 fn, task, taskname, quieterrors, appends, taskdepdata = pickle.loads(data)
417 workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname)) 425 workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname))
418 426
419 pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, appends, taskdepdata, quieterrors) 427 pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, appends, taskdepdata, self.extraconfigdata, quieterrors)
420 428
421 self.build_pids[pid] = task 429 self.build_pids[pid] = task
422 self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout) 430 self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout)
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 3b68c1aaa2..5bce796b7c 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -187,6 +187,7 @@ class CommandsSync:
187 """ 187 """
188 varname = params[0] 188 varname = params[0]
189 value = str(params[1]) 189 value = str(params[1])
190 command.cooker.extraconfigdata[varname] = value
190 command.cooker.data.setVar(varname, value) 191 command.cooker.data.setVar(varname, value)
191 192
192 def getSetVariable(self, command, params): 193 def getSetVariable(self, command, params):
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index a4aaac59f8..620ff9f3d3 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -358,6 +358,7 @@ class BBCooker:
358 self.databuilder.parseBaseConfiguration() 358 self.databuilder.parseBaseConfiguration()
359 self.data = self.databuilder.data 359 self.data = self.databuilder.data
360 self.data_hash = self.databuilder.data_hash 360 self.data_hash = self.databuilder.data_hash
361 self.extraconfigdata = {}
361 362
362 if consolelog: 363 if consolelog:
363 self.data.setVar("BB_CONSOLELOG", consolelog) 364 self.data.setVar("BB_CONSOLELOG", consolelog)
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 389df4f1bc..2ad8aad98e 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1036,6 +1036,7 @@ class RunQueue:
1036 } 1036 }
1037 1037
1038 worker.stdin.write(b"<cookerconfig>" + pickle.dumps(self.cooker.configuration) + b"</cookerconfig>") 1038 worker.stdin.write(b"<cookerconfig>" + pickle.dumps(self.cooker.configuration) + b"</cookerconfig>")
1039 worker.stdin.write(b"<extraconfigdata>" + pickle.dumps(self.cooker.extraconfigdata) + b"</extraconfigdata>")
1039 worker.stdin.write(b"<workerdata>" + pickle.dumps(workerdata) + b"</workerdata>") 1040 worker.stdin.write(b"<workerdata>" + pickle.dumps(workerdata) + b"</workerdata>")
1040 worker.stdin.flush() 1041 worker.stdin.flush()
1041 1042