1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

cache: Use configuration's hash value to validate cache

Previously we use the file time stamp to judge if a cache is valid.
Here this commit introduce a new method, which calculates the total
hash value for a certain configuration's key/value paris, and tag
it into cache filename, for example, bb_cache.dat.xxxyyyzzz.

This mechanism also ensures the cache's correctness if user
dynamically setting variables from some frontend GUI, like HOB.

(Bitbake rev: 1c1df03a6c4717bfd5faab144c4f8bbfcbae0b57)

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Dongxiao Xu
2012-02-23 21:47:13 +08:00
committed by Richard Purdie
parent 99d326a818
commit 8e737db4fc
3 changed files with 36 additions and 21 deletions
+21
View File
@@ -31,6 +31,7 @@ BitBake build tools.
import copy, re
from collections import MutableMapping
import logging
import hashlib
import bb, bb.codeparser
from bb import utils
from bb.COW import COWDictBase
@@ -459,3 +460,23 @@ class DataSmart(MutableMapping):
def __delitem__(self, var):
self.delVar(var)
def get_hash(self):
data = ""
keys = iter(self)
for key in keys:
if key in ["TIME", "DATE"]:
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 ""
data = data + key + ': ' + str(value) + '\n'
return hashlib.md5(data).hexdigest()