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:41:31 +0100 |
commit | c27655793bbda32409e54920e6e2be446feaf23c (patch) | |
tree | 17729c5760b12e1d0b45586f1e20f9504ef4e6e3 | |
parent | a6820f43f597fed57eb1f3eacb963ddf5bd0f1f0 (diff) | |
download | poky-c27655793bbda32409e54920e6e2be446feaf23c.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.
(Bitbake rev: 0f1b142a3f6b8125bf023c2e5ec269618869abf7)
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 2c200db32b..27fb7d9915 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -462,13 +462,14 @@ class DataSmart(MutableMapping): | |||
462 | self.delVar(var) | 462 | self.delVar(var) |
463 | 463 | ||
464 | def get_hash(self): | 464 | def get_hash(self): |
465 | data = "" | 465 | data = {} |
466 | config_whitelist = set((self.getVar("BB_HASHCONFIG_WHITELIST", True) or "").split()) | 466 | config_whitelist = set((self.getVar("BB_HASHCONFIG_WHITELIST", True) or "").split()) |
467 | keys = set(key for key in iter(self) if not key.startswith("__")) | 467 | keys = set(key for key in iter(self) if not key.startswith("__")) |
468 | for key in keys: | 468 | for key in keys: |
469 | if key in config_whitelist: | 469 | if key in config_whitelist: |
470 | continue | 470 | continue |
471 | value = self.getVar(key, False) or "" | 471 | value = self.getVar(key, False) or "" |
472 | data = data + key + ': ' + str(value) + '\n' | 472 | data.update({key:value}) |
473 | 473 | ||
474 | return hashlib.md5(data).hexdigest() | 474 | data_str = str([(k, data[k]) for k in sorted(data.keys())]) |
475 | return hashlib.md5(data_str).hexdigest() | ||