Patchwork [bitbake-devel,1/1] data_smart.py: Uses BB_HASH_WHITELIST to filter unnecessary variables

login
register
mail settings
Submitter Dongxiao Xu
Date Feb. 27, 2012, 7:58 a.m.
Message ID <e00c6d73e3b86d784b1a40b89a0e7622639c4cd6.1330329147.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/22119/
State New
Headers show

Comments

Dongxiao Xu - Feb. 27, 2012, 7:58 a.m.
Adopt the BB_HASH_WHITELIST as a exclusion list for variables that are
not needed in cache hash calculation.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
CC: Christopher Larson <kergoth@gmail.com>
CC: Martin Jansa <martin.jansa@gmail.com>
CC: Andreas Oberritter <obi@opendreambox.org>
---
 lib/bb/data_smart.py |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

Patch

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 24c7a8f..dbf2002 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -463,20 +463,12 @@  class DataSmart(MutableMapping):
 
     def get_hash(self):
         data = ""
-        keys = iter(self)
+        basewhitelist = set((self.getVar("BB_HASHBASE_WHITELIST", True) or "").split())
+        keys = set(key for key in iter(self) if not key.startswith("__"))
         for key in keys:
-            if key in ["TIME", "DATE"]:
+            if key in basewhitelist:
                 continue
-            if key == "__depends":
-                deps = list(self.getVar(key, False))
-                deps.sort()
-                value = [deps[i][0] for i in range(len(deps))]
-            elif key == "PATH":
-                path = list(set(self.getVar(key, False).split(':')))
-                path.sort()
-                value = " ".join(path)
-            else:
-                value = self.getVar(key, False) or ""
+            value = self.getVar(key, False) or ""
             data = data + key + ': ' + str(value) + '\n'
 
         return hashlib.md5(data).hexdigest()