bitbake/lib/bb/data.py:
authorHolger Hans Peter Freyther <zecke@selfish.org>
Sat, 15 Apr 2006 23:18:07 +0000 (23:18 +0000)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Sat, 15 Apr 2006 23:18:07 +0000 (23:18 +0000)
    -Remove the 'Proxies' for the pkgdata Cache
    -Remove the pkgdata() method as we now have
     a different caching strategy
    -Alter init_db to only take a parent and call
     createCopy directly

bitbake/lib/bb/data_smart.py:
    -Remove the DataSmartPackage class as it is not
     needed

bitbake/lib/bb/cache.py:
    -Call init_db with the only reasonable argument

lib/bb/cache.py
lib/bb/data.py
lib/bb/data_smart.py

index e5c5c8e..de4c848 100644 (file)
@@ -195,7 +195,7 @@ class Cache:
         # go there
         oldpath = os.path.abspath(os.getcwd())
         os.chdir(topdir)
-        bb_data = data.init_db(self.cachedir,bbfile, True, cooker.configuration.data)
+        bb_data = data.init_db(cooker.configuration.data)
         try:
             parse.handle(bbfile, bb_data) # read .bb data
             os.chdir(oldpath)
index 1c1eefe..55d1cc9 100644 (file)
@@ -48,85 +48,15 @@ sys.path.insert(0,path)
 from bb import note, debug, data_smart
 
 _dict_type = data_smart.DataSmart
-_dict_p_type = data_smart.DataSmartPackage
-
-class DataDictFull(dict):
-    """
-    This implements our Package Data Storage Interface.
-    setDirty is a no op as all items are held in memory
-    """
-    def setDirty(self, bbfile, data):
-        """
-        No-Op we assume data was manipulated as some sort of
-        reference
-        """
-        if not bbfile in self:
-            raise Exception("File %s was not in dictionary before" % bbfile)
-
-        self[bbfile] = data
-
-class DataDictCache:
-    """
-    Databacked Dictionary implementation
-    """
-    def __init__(self, cache_dir, config):
-        self.cache_dir = cache_dir
-        self.files     = []
-        self.dirty     = {}
-        self.config    = config
-
-    def has_key(self,key):
-        return key in self.files
-
-    def keys(self):
-        return self.files
-
-    def __setitem__(self, key, data):
-        """
-        Add the key to the list of known files and
-        place the data in the cache?
-        """
-        if key in self.files:
-            return
-
-        self.files.append(key)
-
-    def __getitem__(self, key):
-        if not key in self.files:
-            return None
-
-        # if it was dirty we will
-        if key in self.dirty:
-            return self.dirty[key]
-
-        # not cached yet
-        return _dict_p_type(self.cache_dir, key,False,self.config)
-
-    def setDirty(self, bbfile, data):
-        """
-        Only already added items can be declared dirty!!!
-        """
-
-        if not bbfile in self.files:
-            raise Exception("File %s was not in dictionary before" % bbfile)
-
-        self.dirty[bbfile] = data
-
-
 
 def init():
     return _dict_type()
 
-def init_db(cache,name,clean,parent = None):
-    return _dict_p_type(cache,name,clean,parent)
-
-def pkgdata(use_cache, cache, config = None):
-    """
-    Return some sort of dictionary to lookup parsed dictionaires
-    """
-    if use_cache:
-        return DataDictCache(cache, config)
-    return DataDictFull()
+def init_db(parent = None):
+    if parent:
+        return parent.createCopy()
+    else:
+        return _dict_type()
 
 def createCopy(source):
      """Link the source set to the destination
index ca1e3a2..c29ab59 100644 (file)
@@ -270,32 +270,3 @@ class DataSmart:
         self.dict[var] = data
 
 
-class DataSmartPackage(DataSmart):
-    """
-    Persistent Data Storage
-    """
-    def linkDataSet(self):
-        if not self.parent == None:
-            # assume parent is a DataSmartInstance
-            self.dict["_data"] = self.parent.dict
-
-
-    def __init__(self,cache,name,clean,parent):
-        """
-        Construct a persistent data instance
-        """
-        #Initialize the dictionary
-        DataSmart.__init__(self)
-
-        self.cache  = cache
-        self.bbfile = os.path.abspath( name )
-        self.parent = parent
-
-
-
-        # XXX Kill this class, kill this deepcopy by COW
-        self._seen_overrides = copy.deepcopy(parent._seen_overrides)
-        self._special_values = copy.deepcopy(parent._special_values)
-
-        self.linkDataSet()
-