summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-12-03 21:42:36 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-07 12:38:58 +0000
commit86cc1a4104d71235cfdc9b5acfa820758191480a (patch)
treef7d5c2ae11872a93070eb2e8bad9948fbc2d8768 /bitbake
parent7509b5ee0555d1cc8729210e62e122da70b9d080 (diff)
downloadpoky-86cc1a4104d71235cfdc9b5acfa820758191480a.tar.gz
bitbake: bitbake-worker: Pass taskhash as runtask parameter
Pass the task hash as a parameter to the 'runtask' message instead of passing the entire dictionary of hashes when the worker is setup. This is possible less efficient, but prevents the worker taskhashes from being out of sync with the runqueue in the event that the taskhashes in the runqueue change. [YOCTO #13030] (Bitbake rev: 1e86d8c1bec7ea5d016a5ad2097f999362e29033) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-worker8
-rw-r--r--bitbake/lib/bb/runqueue.py15
2 files changed, 10 insertions, 13 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index e925054b7f..cd687e6e43 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, extraconfigdata, quieterrors=False, dry_run_exec=False): 139def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskhash, appends, taskdepdata, extraconfigdata, quieterrors=False, dry_run_exec=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
@@ -234,7 +234,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, append
234 ret = 0 234 ret = 0
235 235
236 the_data = bb_cache.loadDataFull(fn, appends) 236 the_data = bb_cache.loadDataFull(fn, appends)
237 the_data.setVar('BB_TASKHASH', workerdata["runq_hash"][task]) 237 the_data.setVar('BB_TASKHASH', taskhash)
238 238
239 bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", ""))) 239 bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
240 240
@@ -425,10 +425,10 @@ class BitbakeWorker(object):
425 sys.exit(0) 425 sys.exit(0)
426 426
427 def handle_runtask(self, data): 427 def handle_runtask(self, data):
428 fn, task, taskname, quieterrors, appends, taskdepdata, dry_run_exec = pickle.loads(data) 428 fn, task, taskname, taskhash, quieterrors, appends, taskdepdata, dry_run_exec = pickle.loads(data)
429 workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname)) 429 workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname))
430 430
431 pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, appends, taskdepdata, self.extraconfigdata, quieterrors, dry_run_exec) 431 pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, taskhash, appends, taskdepdata, self.extraconfigdata, quieterrors, dry_run_exec)
432 432
433 self.build_pids[pid] = task 433 self.build_pids[pid] = task
434 self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout) 434 self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout)
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 4d5d876797..f2b95a9829 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1224,17 +1224,12 @@ class RunQueue:
1224 bb.utils.nonblockingfd(worker.stdout) 1224 bb.utils.nonblockingfd(worker.stdout)
1225 workerpipe = runQueuePipe(worker.stdout, None, self.cfgData, self, rqexec) 1225 workerpipe = runQueuePipe(worker.stdout, None, self.cfgData, self, rqexec)
1226 1226
1227 runqhash = {}
1228 for tid in self.rqdata.runtaskentries:
1229 runqhash[tid] = self.rqdata.runtaskentries[tid].hash
1230
1231 workerdata = { 1227 workerdata = {
1232 "taskdeps" : self.rqdata.dataCaches[mc].task_deps, 1228 "taskdeps" : self.rqdata.dataCaches[mc].task_deps,
1233 "fakerootenv" : self.rqdata.dataCaches[mc].fakerootenv, 1229 "fakerootenv" : self.rqdata.dataCaches[mc].fakerootenv,
1234 "fakerootdirs" : self.rqdata.dataCaches[mc].fakerootdirs, 1230 "fakerootdirs" : self.rqdata.dataCaches[mc].fakerootdirs,
1235 "fakerootnoenv" : self.rqdata.dataCaches[mc].fakerootnoenv, 1231 "fakerootnoenv" : self.rqdata.dataCaches[mc].fakerootnoenv,
1236 "sigdata" : bb.parse.siggen.get_taskdata(), 1232 "sigdata" : bb.parse.siggen.get_taskdata(),
1237 "runq_hash" : runqhash,
1238 "logdefaultdebug" : bb.msg.loggerDefaultDebugLevel, 1233 "logdefaultdebug" : bb.msg.loggerDefaultDebugLevel,
1239 "logdefaultverbose" : bb.msg.loggerDefaultVerbose, 1234 "logdefaultverbose" : bb.msg.loggerDefaultVerbose,
1240 "logdefaultverboselogs" : bb.msg.loggerVerboseLogs, 1235 "logdefaultverboselogs" : bb.msg.loggerVerboseLogs,
@@ -2031,6 +2026,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
2031 taskdepdata = self.build_taskdepdata(task) 2026 taskdepdata = self.build_taskdepdata(task)
2032 2027
2033 taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] 2028 taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn]
2029 taskhash = self.rqdata.get_task_hash(task)
2034 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce): 2030 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce):
2035 if not mc in self.rq.fakeworker: 2031 if not mc in self.rq.fakeworker:
2036 try: 2032 try:
@@ -2040,10 +2036,10 @@ class RunQueueExecuteTasks(RunQueueExecute):
2040 self.rq.state = runQueueFailed 2036 self.rq.state = runQueueFailed
2041 self.stats.taskFailed() 2037 self.stats.taskFailed()
2042 return True 2038 return True
2043 self.rq.fakeworker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, False, self.cooker.collection.get_file_appends(taskfn), taskdepdata, self.rqdata.setscene_enforce)) + b"</runtask>") 2039 self.rq.fakeworker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, taskhash, False, self.cooker.collection.get_file_appends(taskfn), taskdepdata, self.rqdata.setscene_enforce)) + b"</runtask>")
2044 self.rq.fakeworker[mc].process.stdin.flush() 2040 self.rq.fakeworker[mc].process.stdin.flush()
2045 else: 2041 else:
2046 self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, False, self.cooker.collection.get_file_appends(taskfn), taskdepdata, self.rqdata.setscene_enforce)) + b"</runtask>") 2042 self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, taskhash, False, self.cooker.collection.get_file_appends(taskfn), taskdepdata, self.rqdata.setscene_enforce)) + b"</runtask>")
2047 self.rq.worker[mc].process.stdin.flush() 2043 self.rq.worker[mc].process.stdin.flush()
2048 2044
2049 self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) 2045 self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True)
@@ -2457,13 +2453,14 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
2457 taskdepdata = self.build_taskdepdata(task) 2453 taskdepdata = self.build_taskdepdata(task)
2458 2454
2459 taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] 2455 taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn]
2456 taskhash = self.rqdata.get_task_hash(task)
2460 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run: 2457 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run:
2461 if not mc in self.rq.fakeworker: 2458 if not mc in self.rq.fakeworker:
2462 self.rq.start_fakeworker(self, mc) 2459 self.rq.start_fakeworker(self, mc)
2463 self.rq.fakeworker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, True, self.cooker.collection.get_file_appends(taskfn), taskdepdata, False)) + b"</runtask>") 2460 self.rq.fakeworker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, taskhash, True, self.cooker.collection.get_file_appends(taskfn), taskdepdata, False)) + b"</runtask>")
2464 self.rq.fakeworker[mc].process.stdin.flush() 2461 self.rq.fakeworker[mc].process.stdin.flush()
2465 else: 2462 else:
2466 self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, True, self.cooker.collection.get_file_appends(taskfn), taskdepdata, False)) + b"</runtask>") 2463 self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps((taskfn, task, taskname, taskhash, True, self.cooker.collection.get_file_appends(taskfn), taskdepdata, False)) + b"</runtask>")
2467 self.rq.worker[mc].process.stdin.flush() 2464 self.rq.worker[mc].process.stdin.flush()
2468 2465
2469 self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) 2466 self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True)