mirror of
https://git.yoctoproject.org/poky
synced 2026-05-08 17:19:20 +00:00
cache: change to more incremental format
(Bitbake rev: 4fe4ffbef3885887c97eebe021edc3f23feab9ea) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
committed by
Richard Purdie
parent
5bff22988c
commit
b890c19a33
+33
-22
@@ -183,22 +183,34 @@ class Cache(object):
|
|||||||
newest_mtime = max(old_mtimes)
|
newest_mtime = max(old_mtimes)
|
||||||
|
|
||||||
if bb.parse.cached_mtime_noerror(self.cachefile) >= newest_mtime:
|
if bb.parse.cached_mtime_noerror(self.cachefile) >= newest_mtime:
|
||||||
|
self.load_cachefile()
|
||||||
|
elif os.path.isfile(self.cachefile):
|
||||||
|
logger.info("Out of date cache found, rebuilding...")
|
||||||
|
|
||||||
|
def load_cachefile(self):
|
||||||
|
with open(self.cachefile, "rb") as cachefile:
|
||||||
|
pickled = pickle.Unpickler(cachefile)
|
||||||
try:
|
try:
|
||||||
p = pickle.Unpickler(file(self.cachefile, "rb"))
|
cache_ver = pickled.load()
|
||||||
self.depends_cache, version_data = p.load()
|
bitbake_ver = pickled.load()
|
||||||
if version_data['CACHE_VER'] != __cache_version__:
|
except Exception:
|
||||||
raise ValueError('Cache Version Mismatch')
|
logger.info('Invalid cache, rebuilding...')
|
||||||
if version_data['BITBAKE_VER'] != bb.__version__:
|
return
|
||||||
raise ValueError('Bitbake Version Mismatch')
|
|
||||||
except EOFError:
|
if cache_ver != __cache_version__:
|
||||||
logger.info("Truncated cache found, rebuilding...")
|
logger.info('Cache version mismatch, rebuilding...')
|
||||||
self.depends_cache = {}
|
return
|
||||||
except:
|
elif bitbake_ver != bb.__version__:
|
||||||
logger.info("Invalid cache found, rebuilding...")
|
logger.info('Bitbake version mismatch, rebuilding...')
|
||||||
self.depends_cache = {}
|
return
|
||||||
else:
|
|
||||||
if os.path.isfile(self.cachefile):
|
while cachefile:
|
||||||
logger.info("Out of date cache found, rebuilding...")
|
try:
|
||||||
|
key = pickled.load()
|
||||||
|
value = pickled.load()
|
||||||
|
except Exception:
|
||||||
|
break
|
||||||
|
self.depends_cache[key] = value
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def virtualfn2realfn(virtualfn):
|
def virtualfn2realfn(virtualfn):
|
||||||
@@ -406,14 +418,13 @@ class Cache(object):
|
|||||||
logger.debug(2, "Cache is clean, not saving.")
|
logger.debug(2, "Cache is clean, not saving.")
|
||||||
return
|
return
|
||||||
|
|
||||||
version_data = {
|
|
||||||
'CACHE_VER': __cache_version__,
|
|
||||||
'BITBAKE_VER': bb.__version__,
|
|
||||||
}
|
|
||||||
|
|
||||||
with open(self.cachefile, "wb") as cachefile:
|
with open(self.cachefile, "wb") as cachefile:
|
||||||
pickle.Pickler(cachefile, -1).dump([self.depends_cache,
|
pickler = pickle.Pickler(cachefile, pickle.HIGHEST_PROTOCOL)
|
||||||
version_data])
|
pickler.dump(__cache_version__)
|
||||||
|
pickler.dump(bb.__version__)
|
||||||
|
for key, value in self.depends_cache.iteritems():
|
||||||
|
pickler.dump(key)
|
||||||
|
pickler.dump(value)
|
||||||
|
|
||||||
del self.depends_cache
|
del self.depends_cache
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user