diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-27 15:57:13 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-28 15:34:27 +0100 |
commit | ec4d6b989aad5f4564e367c99c62c59f962b57ea (patch) | |
tree | bd1a4783352a90629a4c07950391cafb986f5373 /bitbake/lib/bb | |
parent | 15ceaaaaf777175df8fa49f08e37b23052ca2290 (diff) | |
download | poky-ec4d6b989aad5f4564e367c99c62c59f962b57ea.tar.gz |
bitbake: Pass task hash information to subprocesses
Pass task has informaiton to work processes, allowing full manipulation of
the hash data in the task context allowing checksums to be usable.
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 23 | ||||
-rw-r--r-- | bitbake/lib/bb/siggen.py | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 201f427f45..dff4ff7f3e 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -30,6 +30,12 @@ import stat | |||
30 | import fcntl | 30 | import fcntl |
31 | import copy | 31 | import copy |
32 | 32 | ||
33 | try: | ||
34 | import cPickle as pickle | ||
35 | except ImportError: | ||
36 | import pickle | ||
37 | bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.") | ||
38 | |||
33 | class RunQueueStats: | 39 | class RunQueueStats: |
34 | """ | 40 | """ |
35 | Holds statistics on the tasks handled by the associated runQueue | 41 | Holds statistics on the tasks handled by the associated runQueue |
@@ -703,6 +709,21 @@ class RunQueueData: | |||
703 | procdep.append(self.taskData.fn_index[self.runq_fnid[dep]] + "." + self.runq_task[dep]) | 709 | procdep.append(self.taskData.fn_index[self.runq_fnid[dep]] + "." + self.runq_task[dep]) |
704 | self.runq_hash[task] = bb.parse.siggen.get_taskhash(self.taskData.fn_index[self.runq_fnid[task]], self.runq_task[task], procdep, self.dataCache) | 710 | self.runq_hash[task] = bb.parse.siggen.get_taskhash(self.taskData.fn_index[self.runq_fnid[task]], self.runq_task[task], procdep, self.dataCache) |
705 | 711 | ||
712 | hashdata = {} | ||
713 | hashdata["hashes"] = {} | ||
714 | hashdata["deps"] = {} | ||
715 | for task in range(len(self.runq_fnid)): | ||
716 | hashdata["hashes"][self.taskData.fn_index[self.runq_fnid[task]] + "." + self.runq_task[task]] = self.runq_hash[task] | ||
717 | deps = [] | ||
718 | for dep in self.runq_depends[task]: | ||
719 | deps.append(self.taskData.fn_index[self.runq_fnid[dep]] + "." + self.runq_task[dep]) | ||
720 | hashdata["deps"][self.taskData.fn_index[self.runq_fnid[task]] + "." + self.runq_task[task]] = deps | ||
721 | |||
722 | # Write out the hashes into a file for use by the individual tasks | ||
723 | self.hashfile = bb.data.expand("${TMPDIR}/cache/hashdata.dat", self.cooker.configuration.data) | ||
724 | p = pickle.Pickler(file(self.hashfile, "wb"), -1) | ||
725 | p.dump(hashdata) | ||
726 | |||
706 | return len(self.runq_fnid) | 727 | return len(self.runq_fnid) |
707 | 728 | ||
708 | def dump_data(self, taskQueue): | 729 | def dump_data(self, taskQueue): |
@@ -1047,7 +1068,7 @@ class RunQueueExecute: | |||
1047 | sys.stdout.flush() | 1068 | sys.stdout.flush() |
1048 | sys.stderr.flush() | 1069 | sys.stderr.flush() |
1049 | 1070 | ||
1050 | proc = subprocess.Popen(["bitbake-runtask", fn, taskname, str(self.cooker.configuration.dry_run)], env=env, stdout=subprocess.PIPE, stdin=subprocess.PIPE) | 1071 | proc = subprocess.Popen(["bitbake-runtask", self.rqdata.hashfile, fn, taskname, str(self.cooker.configuration.dry_run)], env=env, stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
1051 | pipein = proc.stdout | 1072 | pipein = proc.stdout |
1052 | pipeout = proc.stdin | 1073 | pipeout = proc.stdin |
1053 | pid = proc.pid | 1074 | pid = proc.pid |
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index ef14471b66..eb624311a0 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -107,6 +107,10 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
107 | #d.setVar("BB_TASKHASH_task-%s" % task, taskhash[task]) | 107 | #d.setVar("BB_TASKHASH_task-%s" % task, taskhash[task]) |
108 | return h | 108 | return h |
109 | 109 | ||
110 | def set_taskdata(self, hashes, deps): | ||
111 | self.runtaskdeps = deps | ||
112 | self.taskhash = hashes | ||
113 | |||
110 | def dump_sigtask(self, fn, task, stampbase, runtime): | 114 | def dump_sigtask(self, fn, task, stampbase, runtime): |
111 | k = fn + "." + task | 115 | k = fn + "." + task |
112 | if runtime == "customfile": | 116 | if runtime == "customfile": |
@@ -128,7 +132,7 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
128 | data['gendeps'][dep] = self.gendeps[fn][dep] | 132 | data['gendeps'][dep] = self.gendeps[fn][dep] |
129 | data['varvals'][dep] = self.lookupcache[fn][dep] | 133 | data['varvals'][dep] = self.lookupcache[fn][dep] |
130 | 134 | ||
131 | if runtime and runtime != "customfile": | 135 | if runtime: |
132 | data['runtaskdeps'] = self.runtaskdeps[k] | 136 | data['runtaskdeps'] = self.runtaskdeps[k] |
133 | data['runtaskhashes'] = {} | 137 | data['runtaskhashes'] = {} |
134 | for dep in data['runtaskdeps']: | 138 | for dep in data['runtaskdeps']: |