summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-31 14:49:43 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-03 16:08:32 +0100
commit43595fabbe0c9084a3878645aef8e3e1c2f79452 (patch)
tree674fdee5617661909e824840f4028224addced13 /bitbake/lib
parent453d8f49ac0340ecef6429fe539d0e0febf5071a (diff)
downloadpoky-43595fabbe0c9084a3878645aef8e3e1c2f79452.tar.gz
bitbake: Implement signatures
Includes functionality to find out what changes between two different singature data dumps. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cache.py8
-rw-r--r--bitbake/lib/bb/cooker.py4
-rw-r--r--bitbake/lib/bb/parse/__init__.py4
-rw-r--r--bitbake/lib/bb/parse/ast.py6
-rw-r--r--bitbake/lib/bb/runqueue.py38
-rw-r--r--bitbake/lib/bb/utils.py1
6 files changed, 56 insertions, 5 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 21cbad915e..646fdecbeb 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -38,7 +38,7 @@ except ImportError:
38 import pickle 38 import pickle
39 bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.") 39 bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.")
40 40
41__cache_version__ = "131" 41__cache_version__ = "132"
42 42
43class Cache: 43class Cache:
44 """ 44 """
@@ -377,6 +377,10 @@ class Cache:
377 377
378 cacheData.stamp[file_name] = self.getVar('STAMP', file_name, True) 378 cacheData.stamp[file_name] = self.getVar('STAMP', file_name, True)
379 379
380 cacheData.tasks[file_name] = self.getVar('__BBTASKS', file_name, True)
381 for t in cacheData.tasks[file_name]:
382 cacheData.basetaskhash[file_name + "." + t] = self.getVar("BB_BASEHASH_task-%s" % t, file_name, True)
383
380 # build FileName to PackageName lookup table 384 # build FileName to PackageName lookup table
381 cacheData.pkg_fn[file_name] = pn 385 cacheData.pkg_fn[file_name] = pn
382 cacheData.pkg_pepvpr[file_name] = (pe, pv, pr) 386 cacheData.pkg_pepvpr[file_name] = (pe, pv, pr)
@@ -539,6 +543,8 @@ class CacheData:
539 self.task_deps = {} 543 self.task_deps = {}
540 self.stamp = {} 544 self.stamp = {}
541 self.preferred = {} 545 self.preferred = {}
546 self.tasks = {}
547 self.basetaskhash = {}
542 548
543 """ 549 """
544 Indirect Cache variables 550 Indirect Cache variables
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ea33693ddb..5cea9dba9d 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -496,6 +496,8 @@ class BBCooker:
496 def parseConfigurationFiles(self, files): 496 def parseConfigurationFiles(self, files):
497 try: 497 try:
498 data = self.configuration.data 498 data = self.configuration.data
499
500 bb.parse.init_parser(data)
499 for f in files: 501 for f in files:
500 data = bb.parse.handle(f, data) 502 data = bb.parse.handle(f, data)
501 503
@@ -548,6 +550,8 @@ class BBCooker:
548 bb.fetch.fetcher_init(self.configuration.data) 550 bb.fetch.fetcher_init(self.configuration.data)
549 bb.codeparser.parser_cache_init(self.configuration.data) 551 bb.codeparser.parser_cache_init(self.configuration.data)
550 552
553 bb.parse.init_parser(data)
554
551 bb.event.fire(bb.event.ConfigParsed(), self.configuration.data) 555 bb.event.fire(bb.event.ConfigParsed(), self.configuration.data)
552 556
553 except IOError as e: 557 except IOError as e:
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index 95f372b00b..c7249ef050 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -28,6 +28,7 @@ handlers = []
28 28
29import bb, os 29import bb, os
30import bb.utils 30import bb.utils
31import bb.siggen
31 32
32class ParseError(Exception): 33class ParseError(Exception):
33 """Exception raised when parsing fails""" 34 """Exception raised when parsing fails"""
@@ -79,6 +80,9 @@ def init(fn, data):
79 if h['supports'](fn): 80 if h['supports'](fn):
80 return h['init'](data) 81 return h['init'](data)
81 82
83def init_parser(d):
84 bb.parse.siggen = bb.siggen.init(d)
85
82def resolve_file(fn, d): 86def resolve_file(fn, d):
83 if not os.path.isabs(fn): 87 if not os.path.isabs(fn):
84 bbpath = bb.data.getVar("BBPATH", d, True) 88 bbpath = bb.data.getVar("BBPATH", d, True)
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index b800569434..870ae65b0e 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -300,7 +300,7 @@ def handleInherit(statements, m):
300 n = __word__.findall(files) 300 n = __word__.findall(files)
301 statements.append(InheritNode(m.group(1))) 301 statements.append(InheritNode(m.group(1)))
302 302
303def finalize(fn, d): 303def finalize(fn, d, variant = None):
304 for lazykey in bb.data.getVar("__lazy_assigned", d) or (): 304 for lazykey in bb.data.getVar("__lazy_assigned", d) or ():
305 if bb.data.getVar(lazykey, d) is None: 305 if bb.data.getVar(lazykey, d) is None:
306 val = bb.data.getVarFlag(lazykey, "defaultval", d) 306 val = bb.data.getVarFlag(lazykey, "defaultval", d)
@@ -323,7 +323,7 @@ def finalize(fn, d):
323 tasklist = bb.data.getVar('__BBTASKS', d) or [] 323 tasklist = bb.data.getVar('__BBTASKS', d) or []
324 bb.build.add_tasks(tasklist, d) 324 bb.build.add_tasks(tasklist, d)
325 325
326 #bb.data.generate_dependencies(d) 326 bb.parse.siggen.finalise(fn, d, variant)
327 327
328 bb.event.fire(bb.event.RecipeParsed(fn), d) 328 bb.event.fire(bb.event.RecipeParsed(fn), d)
329 329
@@ -433,7 +433,7 @@ def multi_finalize(fn, d):
433 for variant, variant_d in datastores.iteritems(): 433 for variant, variant_d in datastores.iteritems():
434 if variant: 434 if variant:
435 try: 435 try:
436 finalize(fn, variant_d) 436 finalize(fn, variant_d, variant)
437 except bb.parse.SkipPackage: 437 except bb.parse.SkipPackage:
438 bb.data.setVar("__SKIPPED", True, variant_d) 438 bb.data.setVar("__SKIPPED", True, variant_d)
439 439
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 1b974312b2..3d84bb17ee 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -178,6 +178,7 @@ class RunQueueData:
178 self.runq_task = [] 178 self.runq_task = []
179 self.runq_depends = [] 179 self.runq_depends = []
180 self.runq_revdeps = [] 180 self.runq_revdeps = []
181 self.runq_hash = []
181 182
182 def runq_depends_names(self, ids): 183 def runq_depends_names(self, ids):
183 import re 184 import re
@@ -477,6 +478,7 @@ class RunQueueData:
477 self.runq_task.append(taskData.tasks_name[task]) 478 self.runq_task.append(taskData.tasks_name[task])
478 self.runq_depends.append(set(depends)) 479 self.runq_depends.append(set(depends))
479 self.runq_revdeps.append(set()) 480 self.runq_revdeps.append(set())
481 self.runq_hash.append("")
480 482
481 runq_build.append(0) 483 runq_build.append(0)
482 runq_recrdepends.append(recrdepends) 484 runq_recrdepends.append(recrdepends)
@@ -589,6 +591,7 @@ class RunQueueData:
589 del self.runq_depends[listid-delcount] 591 del self.runq_depends[listid-delcount]
590 del runq_build[listid-delcount] 592 del runq_build[listid-delcount]
591 del self.runq_revdeps[listid-delcount] 593 del self.runq_revdeps[listid-delcount]
594 del self.runq_hash[listid-delcount]
592 delcount = delcount + 1 595 delcount = delcount + 1
593 maps.append(-1) 596 maps.append(-1)
594 597
@@ -686,6 +689,20 @@ class RunQueueData:
686 #bb.note("Found setscene for %s %s" % (self.taskData.fn_index[self.runq_fnid[task]], self.runq_task[task])) 689 #bb.note("Found setscene for %s %s" % (self.taskData.fn_index[self.runq_fnid[task]], self.runq_task[task]))
687 self.runq_setscene.append(task) 690 self.runq_setscene.append(task)
688 691
692 # Interate over the task list and call into the siggen code
693
694 dealtwith = set()
695 todeal = set(range(len(self.runq_fnid)))
696 while len(todeal) > 0:
697 for task in todeal.copy():
698 if len(self.runq_depends[task] - dealtwith) == 0:
699 dealtwith.add(task)
700 todeal.remove(task)
701 procdep = []
702 for dep in self.runq_depends[task]:
703 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)
705
689 return len(self.runq_fnid) 706 return len(self.runq_fnid)
690 707
691 def dump_data(self, taskQueue): 708 def dump_data(self, taskQueue):
@@ -885,7 +902,10 @@ class RunQueue:
885 self.state = runQueueSceneInit 902 self.state = runQueueSceneInit
886 903
887 if self.state is runQueueSceneInit: 904 if self.state is runQueueSceneInit:
888 self.rqexe = RunQueueExecuteScenequeue(self) 905 if self.cooker.configuration.dump_signatures:
906 self.dump_signatures()
907 else:
908 self.rqexe = RunQueueExecuteScenequeue(self)
889 909
890 if self.state is runQueueSceneRun: 910 if self.state is runQueueSceneRun:
891 self.rqexe.execute() 911 self.rqexe.execute()
@@ -926,6 +946,20 @@ class RunQueue:
926 else: 946 else:
927 self.rqexe.finish() 947 self.rqexe.finish()
928 948
949 def dump_signatures(self):
950 self.state = runQueueComplete
951 done = set()
952 bb.note("Reparsing files to collect dependency data")
953 for task in range(len(self.rqdata.runq_fnid)):
954 if self.rqdata.runq_fnid[task] not in done:
955 fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]]
956 the_data = self.cooker.bb_cache.loadDataFull(fn, self.cooker.get_file_appends(fn), self.cooker.configuration.data)
957 done.add(self.rqdata.runq_fnid[task])
958
959 bb.parse.siggen.dump_sigs(self.rqdata.dataCache)
960
961 return
962
929 963
930class RunQueueExecute: 964class RunQueueExecute:
931 965
@@ -1007,6 +1041,8 @@ class RunQueueExecute:
1007 comps = var.split("=") 1041 comps = var.split("=")
1008 env[comps[0]] = comps[1] 1042 env[comps[0]] = comps[1]
1009 1043
1044 env['BB_TASKHASH'] = self.rqdata.runq_hash[task]
1045
1010 sys.stdout.flush() 1046 sys.stdout.flush()
1011 sys.stderr.flush() 1047 sys.stderr.flush()
1012 1048
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 9fc56eaa0f..c2e6ff08ed 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -452,6 +452,7 @@ def preserved_envvars_list():
452 'BB_PRESERVE_ENV', 452 'BB_PRESERVE_ENV',
453 'BB_ENV_WHITELIST', 453 'BB_ENV_WHITELIST',
454 'BB_ENV_EXTRAWHITE', 454 'BB_ENV_EXTRAWHITE',
455 'BB_TASKHASH',
455 'COLORTERM', 456 'COLORTERM',
456 'DBUS_SESSION_BUS_ADDRESS', 457 'DBUS_SESSION_BUS_ADDRESS',
457 'DESKTOP_SESSION', 458 'DESKTOP_SESSION',