From d0616923724c5d021a816ec778e836283a2ccfe2 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 25 Nov 2013 23:18:22 +0000 Subject: bitbake: bitbake: Share BB_TASKDEPDATA with tasks Currently tasks have no knowledge of which other tasks they depend upon. This makes it impossible to do at least two things which would be desirable/interesting: a) Have the ability to create per recipe sysroots b) Allow the aclocal files to be present only for the entries in DEPENDS (directly and indirectly) By exporting task data through this new variable, tasks can inspect their dependencies and then take actions based upon this. (Bitbake rev: 84f1dde717dac22435005b79d03ee0b80a3e8e62) Signed-off-by: Richard Purdie --- bitbake/lib/bb/runqueue.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/bb/runqueue.py') diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index f984119e87..428cff1c80 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py @@ -1437,14 +1437,16 @@ class RunQueueExecuteTasks(RunQueueExecute): startevent = runQueueTaskStarted(task, self.stats, self.rq) bb.event.fire(startevent, self.cfgData) + taskdepdata = self.build_taskdepdata(task) + taskdep = self.rqdata.dataCache.task_deps[fn] if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run: if not self.rq.fakeworker: self.rq.start_fakeworker(self) - self.rq.fakeworker.stdin.write("" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn))) + "") + self.rq.fakeworker.stdin.write("" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn), taskdepdata)) + "") self.rq.fakeworker.stdin.flush() else: - self.rq.worker.stdin.write("" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn))) + "") + self.rq.worker.stdin.write("" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn), taskdepdata)) + "") self.rq.worker.stdin.flush() self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCache, fn) @@ -1474,6 +1476,26 @@ class RunQueueExecuteTasks(RunQueueExecute): return True + def build_taskdepdata(self, task): + taskdepdata = {} + next = self.rqdata.runq_depends[task] + next.add(task) + while next: + additional = [] + for revdep in next: + fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[revdep]] + pn = self.rqdata.dataCache.pkg_fn[fn] + taskname = self.rqdata.runq_task[revdep] + deps = self.rqdata.runq_depends[revdep] + taskdepdata[revdep] = [pn, taskname, fn, deps] + for revdep2 in deps: + if revdep2 not in taskdepdata: + additional.append(revdep2) + next = additional + + #bb.note("Task %s: " % task + str(taskdepdata).replace("], ", "],\n")) + return taskdepdata + class RunQueueExecuteScenequeue(RunQueueExecute): def __init__(self, rq): RunQueueExecute.__init__(self, rq) @@ -1784,10 +1806,10 @@ class RunQueueExecuteScenequeue(RunQueueExecute): if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: if not self.rq.fakeworker: self.rq.start_fakeworker(self) - self.rq.fakeworker.stdin.write("" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn))) + "") + self.rq.fakeworker.stdin.write("" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn), None)) + "") self.rq.fakeworker.stdin.flush() else: - self.rq.worker.stdin.write("" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn))) + "") + self.rq.worker.stdin.write("" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn), None)) + "") self.rq.worker.stdin.flush() self.runq_running[task] = 1 -- cgit v1.2.3-54-g00ecf