diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-04-15 23:18:07 +0000 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-04-15 23:18:07 +0000 |
commit | 40d07e863a1fb8a747f9efb1d483b5ac50ca449f (patch) | |
tree | caf3ac984352eee043038eda97c37be62532288f /lib/bb/data.py | |
parent | 17ecb65b392e98860661502015759782b55028a7 (diff) | |
download | bitbake-40d07e863a1fb8a747f9efb1d483b5ac50ca449f.tar.gz |
bitbake/lib/bb/data.py:
-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
Diffstat (limited to 'lib/bb/data.py')
-rw-r--r-- | lib/bb/data.py | 80 |
1 files changed, 5 insertions, 75 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py index 1c1eefe9d..55d1cc905 100644 --- a/lib/bb/data.py +++ b/lib/bb/data.py @@ -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 |