summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-25 23:18:22 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-26 23:01:33 +0000
commitd0616923724c5d021a816ec778e836283a2ccfe2 (patch)
tree1461f9fed7433f94c5c7ddc6b68121522f3b8391 /bitbake
parent4c69970bd379f441279fe46edd92613e80ea3dc5 (diff)
downloadpoky-d0616923724c5d021a816ec778e836283a2ccfe2.tar.gz
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-worker7
-rw-r--r--bitbake/lib/bb/runqueue.py30
2 files changed, 30 insertions, 7 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index ff20c1ca98..bc13b4f314 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -81,7 +81,7 @@ def workerlog_write(msg):
81 lf.write(msg) 81 lf.write(msg)
82 lf.flush() 82 lf.flush()
83 83
84def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, quieterrors=False): 84def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, taskdepdata, quieterrors=False):
85 # We need to setup the environment BEFORE the fork, since 85 # We need to setup the environment BEFORE the fork, since
86 # a fork() or exec*() activates PSEUDO... 86 # a fork() or exec*() activates PSEUDO...
87 87
@@ -148,6 +148,7 @@ def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, quieterror
148 os.umask(umask) 148 os.umask(umask)
149 149
150 data.setVar("BB_WORKERCONTEXT", "1") 150 data.setVar("BB_WORKERCONTEXT", "1")
151 data.setVar("BB_TASKDEPDATA", taskdepdata)
151 data.setVar("BUILDNAME", workerdata["buildname"]) 152 data.setVar("BUILDNAME", workerdata["buildname"])
152 data.setVar("DATE", workerdata["date"]) 153 data.setVar("DATE", workerdata["date"])
153 data.setVar("TIME", workerdata["time"]) 154 data.setVar("TIME", workerdata["time"])
@@ -300,10 +301,10 @@ class BitbakeWorker(object):
300 sys.exit(0) 301 sys.exit(0)
301 302
302 def handle_runtask(self, data): 303 def handle_runtask(self, data):
303 fn, task, taskname, quieterrors, appends = pickle.loads(data) 304 fn, task, taskname, quieterrors, appends, taskdepdata = pickle.loads(data)
304 workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname)) 305 workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname))
305 306
306 pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.workerdata, fn, task, taskname, appends, quieterrors) 307 pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.workerdata, fn, task, taskname, appends, taskdepdata, quieterrors)
307 308
308 self.build_pids[pid] = task 309 self.build_pids[pid] = task
309 self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout) 310 self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout)
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):
1437 startevent = runQueueTaskStarted(task, self.stats, self.rq) 1437 startevent = runQueueTaskStarted(task, self.stats, self.rq)
1438 bb.event.fire(startevent, self.cfgData) 1438 bb.event.fire(startevent, self.cfgData)
1439 1439
1440 taskdepdata = self.build_taskdepdata(task)
1441
1440 taskdep = self.rqdata.dataCache.task_deps[fn] 1442 taskdep = self.rqdata.dataCache.task_deps[fn]
1441 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run: 1443 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run:
1442 if not self.rq.fakeworker: 1444 if not self.rq.fakeworker:
1443 self.rq.start_fakeworker(self) 1445 self.rq.start_fakeworker(self)
1444 self.rq.fakeworker.stdin.write("<runtask>" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn))) + "</runtask>") 1446 self.rq.fakeworker.stdin.write("<runtask>" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn), taskdepdata)) + "</runtask>")
1445 self.rq.fakeworker.stdin.flush() 1447 self.rq.fakeworker.stdin.flush()
1446 else: 1448 else:
1447 self.rq.worker.stdin.write("<runtask>" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn))) + "</runtask>") 1449 self.rq.worker.stdin.write("<runtask>" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn), taskdepdata)) + "</runtask>")
1448 self.rq.worker.stdin.flush() 1450 self.rq.worker.stdin.flush()
1449 1451
1450 self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCache, fn) 1452 self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
@@ -1474,6 +1476,26 @@ class RunQueueExecuteTasks(RunQueueExecute):
1474 1476
1475 return True 1477 return True
1476 1478
1479 def build_taskdepdata(self, task):
1480 taskdepdata = {}
1481 next = self.rqdata.runq_depends[task]
1482 next.add(task)
1483 while next:
1484 additional = []
1485 for revdep in next:
1486 fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[revdep]]
1487 pn = self.rqdata.dataCache.pkg_fn[fn]
1488 taskname = self.rqdata.runq_task[revdep]
1489 deps = self.rqdata.runq_depends[revdep]
1490 taskdepdata[revdep] = [pn, taskname, fn, deps]
1491 for revdep2 in deps:
1492 if revdep2 not in taskdepdata:
1493 additional.append(revdep2)
1494 next = additional
1495
1496 #bb.note("Task %s: " % task + str(taskdepdata).replace("], ", "],\n"))
1497 return taskdepdata
1498
1477class RunQueueExecuteScenequeue(RunQueueExecute): 1499class RunQueueExecuteScenequeue(RunQueueExecute):
1478 def __init__(self, rq): 1500 def __init__(self, rq):
1479 RunQueueExecute.__init__(self, rq) 1501 RunQueueExecute.__init__(self, rq)
@@ -1784,10 +1806,10 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
1784 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: 1806 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']:
1785 if not self.rq.fakeworker: 1807 if not self.rq.fakeworker:
1786 self.rq.start_fakeworker(self) 1808 self.rq.start_fakeworker(self)
1787 self.rq.fakeworker.stdin.write("<runtask>" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn))) + "</runtask>") 1809 self.rq.fakeworker.stdin.write("<runtask>" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn), None)) + "</runtask>")
1788 self.rq.fakeworker.stdin.flush() 1810 self.rq.fakeworker.stdin.flush()
1789 else: 1811 else:
1790 self.rq.worker.stdin.write("<runtask>" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn))) + "</runtask>") 1812 self.rq.worker.stdin.write("<runtask>" + pickle.dumps((fn, realtask, taskname, True, self.cooker.collection.get_file_appends(fn), None)) + "</runtask>")
1791 self.rq.worker.stdin.flush() 1813 self.rq.worker.stdin.flush()
1792 1814
1793 self.runq_running[task] = 1 1815 self.runq_running[task] = 1