[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1498/8267] bitbake: cache: Add better cache loading sanity checks



commit 5d41200113c32d61c2495aae72525e3f7a84715b
Author: Richard Purdie <richard purdie linuxfoundation org>
Date:   Fri Jul 22 11:28:23 2016 +0100

    bitbake: cache: Add better cache loading sanity checks
    
    We've seen cache corruption where the pairs come out in a different
    order to the way we saved them for unknown reasons. Add better sanity
    checking to give a more user friendly error rather than a crash/traceback.
    
    Also allows the system to reparse and recover.
    
    (Bitbake rev: 4be4a15491530bd6dc018033ad3d4b2562ab6e23)
    
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/bb/cache.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index cce12d1..439565f 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -328,6 +328,13 @@ class Cache(object):
                         value = pickled.load()
                     except Exception:
                         break
+                    if not isinstance(key, str):
+                        bb.warn("%s from extras cache is not a string?" % key)
+                        break
+                    if not isinstance(value, RecipeInfoCommon):
+                        bb.warn("%s from extras cache is not a RecipeInfoCommon class?" % value)
+                        break
+
                     if key in self.depends_cache:
                         self.depends_cache[key].append(value)
                     else:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]