diff options
author | Dongxiao Xu <dongxiao.xu@intel.com> | 2012-04-17 16:21:37 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-17 11:40:16 +0100 |
commit | 0f1b142a3f6b8125bf023c2e5ec269618869abf7 (patch) | |
tree | afc39b2a3680fd1b3c6598e08b94837a5ae5003a /lib/bb/data_smart.py | |
parent | 98694c1dbc276cc151f393db67bfd43442da28ba (diff) | |
download | bitbake-contrib-0f1b142a3f6b8125bf023c2e5ec269618869abf7.tar.gz |
data_smart: Improve the calculation of config hash
For config hash, we put the keys in structure of "set()", which is not
order sensitive. Therefore when calculating the md5 value for config
hash, we need to identify the order of the keys.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/data_smart.py')
-rw-r--r-- | lib/bb/data_smart.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index 2c200db32..27fb7d991 100644 --- a/lib/bb/data_smart.py +++ b/lib/bb/data_smart.py @@ -462,13 +462,14 @@ class DataSmart(MutableMapping): self.delVar(var) def get_hash(self): - data = "" + data = {} config_whitelist = set((self.getVar("BB_HASHCONFIG_WHITELIST", True) or "").split()) keys = set(key for key in iter(self) if not key.startswith("__")) for key in keys: if key in config_whitelist: continue value = self.getVar(key, False) or "" - data = data + key + ': ' + str(value) + '\n' + data.update({key:value}) - return hashlib.md5(data).hexdigest() + data_str = str([(k, data[k]) for k in sorted(data.keys())]) + return hashlib.md5(data_str).hexdigest() |