summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/siggen.py
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2011-01-01 23:55:54 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:54 +0000
commit0090a798eb868ebc926944eac2e6d4a5aff3e1b3 (patch)
tree9b90e66234e6ad7b9616c8c5944029426746110f /bitbake/lib/bb/siggen.py
parente8c48e668c7525257926ab7db9b6e44aa2705483 (diff)
downloadpoky-0090a798eb868ebc926944eac2e6d4a5aff3e1b3.tar.gz
bitbake: Sync a load of whitespace and other non-functionality changes with bitbake uptream
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/siggen.py')
-rw-r--r--bitbake/lib/bb/siggen.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index 48f600a212..94ae2b48ab 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -1,37 +1,47 @@
1import hashlib 1import hashlib
2import logging
2import re 3import re
3 4
5logger = logging.getLogger('BitBake.SigGen')
6
4try: 7try:
5 import cPickle as pickle 8 import cPickle as pickle
6except ImportError: 9except ImportError:
7 import pickle 10 import pickle
8 bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.") 11 logger.info('Importing cPickle failed. Falling back to a very slow implementation.')
9 12
10def init(d, dumpsigs): 13def init(d):
11 siggens = [obj for obj in globals().itervalues() 14 siggens = [obj for obj in globals().itervalues()
12 if type(obj) is type and issubclass(obj, SignatureGenerator)] 15 if type(obj) is type and issubclass(obj, SignatureGenerator)]
13 16
14 desired = bb.data.getVar("BB_SIGNATURE_HANDLER", d, True) or "noop" 17 desired = bb.data.getVar("BB_SIGNATURE_HANDLER", d, True) or "noop"
15 for sg in siggens: 18 for sg in siggens:
16 if desired == sg.name: 19 if desired == sg.name:
17 return sg(d, dumpsigs) 20 return sg(d)
18 break 21 break
19 else: 22 else:
20 bb.error("Invalid signature generator '%s', using default 'noop' generator" % desired) 23 logger.error("Invalid signature generator '%s', using default 'noop'\n"
21 bb.error("Available generators: %s" % ", ".join(obj.name for obj in siggens)) 24 "Available generators: %s",
22 return SignatureGenerator(d, dumpsigs) 25 ', '.join(obj.name for obj in siggens))
26 return SignatureGenerator(d)
23 27
24class SignatureGenerator(object): 28class SignatureGenerator(object):
25 """ 29 """
26 """ 30 """
27 name = "noop" 31 name = "noop"
28 32
29 def __init__(self, data, dumpsigs): 33 def __init__(self, data):
30 return 34 return
31 35
32 def finalise(self, fn, d, varient): 36 def finalise(self, fn, d, varient):
33 return 37 return
34 38
39 def get_taskhash(self, fn, task, deps, dataCache):
40 return 0
41
42 def set_taskdata(self, hashes, deps):
43 return
44
35 def stampfile(self, stampbase, taskname, taskhash): 45 def stampfile(self, stampbase, taskname, taskhash):
36 return "%s.%s" % (stampbase, taskname) 46 return "%s.%s" % (stampbase, taskname)
37 47
@@ -40,7 +50,7 @@ class SignatureGeneratorBasic(SignatureGenerator):
40 """ 50 """
41 name = "basic" 51 name = "basic"
42 52
43 def __init__(self, data, dumpsigs): 53 def __init__(self, data):
44 self.basehash = {} 54 self.basehash = {}
45 self.taskhash = {} 55 self.taskhash = {}
46 self.taskdeps = {} 56 self.taskdeps = {}
@@ -78,7 +88,6 @@ class SignatureGeneratorBasic(SignatureGenerator):
78 if data is None: 88 if data is None:
79 bb.error("Task %s from %s seems to be empty?!" % (task, fn)) 89 bb.error("Task %s from %s seems to be empty?!" % (task, fn))
80 self.basehash[fn + "." + task] = hashlib.md5(data).hexdigest() 90 self.basehash[fn + "." + task] = hashlib.md5(data).hexdigest()
81 #bb.note("Hash for %s is %s" % (task, tashhash[task]))
82 91
83 self.taskdeps[fn] = taskdeps 92 self.taskdeps[fn] = taskdeps
84 self.gendeps[fn] = gendeps 93 self.gendeps[fn] = gendeps
@@ -110,7 +119,6 @@ class SignatureGeneratorBasic(SignatureGenerator):
110 # then process the actual dependencies 119 # then process the actual dependencies
111 dep_fn = re.search("(?P<fn>.*)\..*", dep).group('fn') 120 dep_fn = re.search("(?P<fn>.*)\..*", dep).group('fn')
112 if self.twl.search(dataCache.pkg_fn[dep_fn]): 121 if self.twl.search(dataCache.pkg_fn[dep_fn]):
113 #bb.note("Skipping %s" % dep)
114 continue 122 continue
115 if dep not in self.taskhash: 123 if dep not in self.taskhash:
116 bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?", dep) 124 bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?", dep)
@@ -181,10 +189,6 @@ def compare_sigfiles(a, b):
181 p2 = pickle.Unpickler(file(b, "rb")) 189 p2 = pickle.Unpickler(file(b, "rb"))
182 b_data = p2.load() 190 b_data = p2.load()
183 191
184 #print "Checking"
185 #print str(a_data)
186 #print str(b_data)
187
188 def dict_diff(a, b): 192 def dict_diff(a, b):
189 sa = set(a.keys()) 193 sa = set(a.keys())
190 sb = set(b.keys()) 194 sb = set(b.keys())
@@ -195,7 +199,7 @@ def compare_sigfiles(a, b):
195 changed.add(i) 199 changed.add(i)
196 added = sa - sb 200 added = sa - sb
197 removed = sb - sa 201 removed = sb - sa
198 return changed, added, removed 202 return changed, added, removed
199 203
200 if 'basewhitelist' in a_data and a_data['basewhitelist'] != b_data['basewhitelist']: 204 if 'basewhitelist' in a_data and a_data['basewhitelist'] != b_data['basewhitelist']:
201 print "basewhitelist changed from %s to %s" % (a_data['basewhitelist'], b_data['basewhitelist']) 205 print "basewhitelist changed from %s to %s" % (a_data['basewhitelist'], b_data['basewhitelist'])
@@ -225,11 +229,6 @@ def compare_sigfiles(a, b):
225 if changed: 229 if changed:
226 for dep in changed: 230 for dep in changed:
227 print "Variable %s value changed from %s to %s" % (dep, a_data['varvals'][dep], b_data['varvals'][dep]) 231 print "Variable %s value changed from %s to %s" % (dep, a_data['varvals'][dep], b_data['varvals'][dep])
228 #if added:
229 # print "Dependency on variable %s was added (value %s)" % (dep, b_data['gendeps'][dep])
230 #if removed:
231 # print "Dependency on Variable %s was removed (value %s)" % (dep, a_data['gendeps'][dep])
232
233 if 'runtaskdeps' in a_data and 'runtaskdeps' in b_data and sorted(a_data['runtaskdeps']) != sorted(b_data['runtaskdeps']): 232 if 'runtaskdeps' in a_data and 'runtaskdeps' in b_data and sorted(a_data['runtaskdeps']) != sorted(b_data['runtaskdeps']):
234 print "Tasks this task depends on changed from %s to %s" % (sorted(a_data['runtaskdeps']), sorted(b_data['runtaskdeps'])) 233 print "Tasks this task depends on changed from %s to %s" % (sorted(a_data['runtaskdeps']), sorted(b_data['runtaskdeps']))
235 234