summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-09-28 22:24:13 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-29 10:47:17 +0100
commit9747616600b424e8c0d7075a9b516a12d65a17c3 (patch)
tree5a59f32ae06bb18565bdffe12414902337b8fa93 /bitbake
parent8976fa69d0ddfdad24fe041f4b88c853dc7a33a2 (diff)
downloadopenembedded-core-9747616600b424e8c0d7075a9b516a12d65a17c3.tar.gz
openembedded-core-9747616600b424e8c0d7075a9b516a12d65a17c3.tar.bz2
openembedded-core-9747616600b424e8c0d7075a9b516a12d65a17c3.zip
bitbake/siggen: Ensure full signature data is not held unless needed, reducing memory consumption
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py4
-rw-r--r--bitbake/lib/bb/parse/__init__.py4
-rw-r--r--bitbake/lib/bb/siggen.py29
3 files changed, 22 insertions, 15 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 5cea9dba9d..44b9b2c31a 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -497,7 +497,7 @@ class BBCooker:
try:
data = self.configuration.data
- bb.parse.init_parser(data)
+ bb.parse.init_parser(data, self.configuration.dump_signatures)
for f in files:
data = bb.parse.handle(f, data)
@@ -550,7 +550,7 @@ class BBCooker:
bb.fetch.fetcher_init(self.configuration.data)
bb.codeparser.parser_cache_init(self.configuration.data)
- bb.parse.init_parser(data)
+ bb.parse.init_parser(data, self.configuration.dump_signatures)
bb.event.fire(bb.event.ConfigParsed(), self.configuration.data)
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index c7249ef050..da160ceb27 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -80,8 +80,8 @@ def init(fn, data):
if h['supports'](fn):
return h['init'](data)
-def init_parser(d):
- bb.parse.siggen = bb.siggen.init(d)
+def init_parser(d, dumpsigs):
+ bb.parse.siggen = bb.siggen.init(d, dumpsigs)
def resolve_file(fn, d):
if not os.path.isabs(fn):
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index eb624311a0..2948372c6a 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -7,26 +7,26 @@ except ImportError:
import pickle
bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.")
-def init(d):
+def init(d, dumpsigs):
siggens = [obj for obj in globals().itervalues()
if type(obj) is type and issubclass(obj, SignatureGenerator)]
desired = bb.data.getVar("BB_SIGNATURE_HANDLER", d, True) or "noop"
for sg in siggens:
if desired == sg.name:
- return sg(d)
+ return sg(d, dumpsigs)
break
else:
bb.error("Invalid signature generator '%s', using default 'noop' generator" % desired)
bb.error("Available generators: %s" % ", ".join(obj.name for obj in siggens))
- return SignatureGenerator(d)
+ return SignatureGenerator(d, dumpsigs)
class SignatureGenerator(object):
"""
"""
name = "noop"
- def __init__(self, data):
+ def __init__(self, data, dumpsigs):
return
def finalise(self, fn, d):
@@ -37,7 +37,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
"""
name = "basic"
- def __init__(self, data):
+ def __init__(self, data, dumpsigs):
self.basehash = {}
self.taskhash = {}
self.taskdeps = {}
@@ -52,17 +52,19 @@ class SignatureGeneratorBasic(SignatureGenerator):
else:
self.twl = None
+ self.dumpsigs = dumpsigs
+
def _build_data(self, fn, d):
- self.taskdeps[fn], self.gendeps[fn] = bb.data.generate_dependencies(d)
+ taskdeps, gendeps = bb.data.generate_dependencies(d)
basehash = {}
lookupcache = {}
- for task in self.taskdeps[fn]:
+ for task in taskdeps:
data = d.getVar(task, False)
lookupcache[task] = data
- for dep in sorted(self.taskdeps[fn][task]):
+ for dep in sorted(taskdeps[task]):
if dep in self.basewhitelist:
continue
if dep in lookupcache:
@@ -75,20 +77,25 @@ class SignatureGeneratorBasic(SignatureGenerator):
self.basehash[fn + "." + task] = hashlib.md5(data).hexdigest()
#bb.note("Hash for %s is %s" % (task, tashhash[task]))
- self.lookupcache[fn] = lookupcache
+ if self.dumpsigs:
+ self.taskdeps[fn] = taskdeps
+ self.gendeps[fn] = gendeps
+ self.lookupcache[fn] = lookupcache
+
+ return taskdeps
def finalise(self, fn, d, variant):
if variant:
fn = "virtual:" + variant + ":" + fn
- self._build_data(fn, d)
+ taskdeps = self._build_data(fn, d)
#Slow but can be useful for debugging mismatched basehashes
#for task in self.taskdeps[fn]:
# self.dump_sigtask(fn, task, d.getVar("STAMP", True), False)
- for task in self.taskdeps[fn]:
+ for task in taskdeps:
d.setVar("BB_BASEHASH_task-%s" % task, self.basehash[fn + "." + task])
def get_taskhash(self, fn, task, deps, dataCache):