summaryrefslogtreecommitdiffstats
path: root/bitbake-dev/lib/bb/cache.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake-dev/lib/bb/cache.py')
-rw-r--r--bitbake-dev/lib/bb/cache.py70
1 files changed, 62 insertions, 8 deletions
diff --git a/bitbake-dev/lib/bb/cache.py b/bitbake-dev/lib/bb/cache.py
index a6b81333d1..1001012e0c 100644
--- a/bitbake-dev/lib/bb/cache.py
+++ b/bitbake-dev/lib/bb/cache.py
@@ -63,7 +63,7 @@ class Cache:
63 63
64 self.has_cache = True 64 self.has_cache = True
65 self.cachefile = os.path.join(self.cachedir,"bb_cache.dat") 65 self.cachefile = os.path.join(self.cachedir,"bb_cache.dat")
66 66
67 bb.msg.debug(1, bb.msg.domain.Cache, "Using cache in '%s'" % self.cachedir) 67 bb.msg.debug(1, bb.msg.domain.Cache, "Using cache in '%s'" % self.cachedir)
68 try: 68 try:
69 os.stat( self.cachedir ) 69 os.stat( self.cachedir )
@@ -125,30 +125,59 @@ class Cache:
125 self.depends_cache[fn][var] = result 125 self.depends_cache[fn][var] = result
126 return result 126 return result
127 127
128 def setData(self, fn, data): 128 def setData(self, virtualfn, fn, data):
129 """ 129 """
130 Called to prime bb_cache ready to learn which variables to cache. 130 Called to prime bb_cache ready to learn which variables to cache.
131 Will be followed by calls to self.getVar which aren't cached 131 Will be followed by calls to self.getVar which aren't cached
132 but can be fulfilled from self.data. 132 but can be fulfilled from self.data.
133 """ 133 """
134 self.data_fn = fn 134 self.data_fn = virtualfn
135 self.data = data 135 self.data = data
136 136
137 # Make sure __depends makes the depends_cache 137 # Make sure __depends makes the depends_cache
138 self.getVar("__depends", fn, True) 138 self.getVar("__depends", virtualfn, True)
139 self.depends_cache[fn]["CACHETIMESTAMP"] = bb.parse.cached_mtime(fn) 139 self.depends_cache[virtualfn]["CACHETIMESTAMP"] = bb.parse.cached_mtime(fn)
140
141 def virtualfn2realfn(self, virtualfn):
142 """
143 Convert a virtual file name to a real one + the associated subclass keyword
144 """
145
146 fn = virtualfn
147 cls = ""
148 if virtualfn.startswith('virtual:'):
149 cls = virtualfn.split(':', 2)[1]
150 fn = virtualfn.replace('virtual:' + cls + ':', '')
151 #bb.msg.debug(2, bb.msg.domain.Cache, "virtualfn2realfn %s to %s %s" % (virtualfn, fn, cls))
152 return (fn, cls)
153
154 def realfn2virtual(self, realfn, cls):
155 """
156 Convert a real filename + the associated subclass keyword to a virtual filename
157 """
158 if cls == "":
159 #bb.msg.debug(2, bb.msg.domain.Cache, "realfn2virtual %s and '%s' to %s" % (realfn, cls, realfn))
160 return realfn
161 #bb.msg.debug(2, bb.msg.domain.Cache, "realfn2virtual %s and %s to %s" % (realfn, cls, "virtual:" + cls + ":" + realfn))
162 return "virtual:" + cls + ":" + realfn
140 163
141 def loadDataFull(self, fn, cfgData): 164 def loadDataFull(self, virtualfn, cfgData):
142 """ 165 """
143 Return a complete set of data for fn. 166 Return a complete set of data for fn.
144 To do this, we need to parse the file. 167 To do this, we need to parse the file.
145 """ 168 """
169
170 (fn, cls) = self.virtualfn2realfn(virtualfn)
171
146 bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s (full)" % fn) 172 bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s (full)" % fn)
147 173
148 bb_data, skipped = self.load_bbfile(fn, cfgData) 174 bb_data, skipped = self.load_bbfile(fn, cfgData)
175 if isinstance(bb_data, dict):
176 return bb_data[cls]
177
149 return bb_data 178 return bb_data
150 179
151 def loadData(self, fn, cfgData): 180 def loadData(self, fn, cfgData, cacheData):
152 """ 181 """
153 Load a subset of data for fn. 182 Load a subset of data for fn.
154 If the cached data is valid we do nothing, 183 If the cached data is valid we do nothing,
@@ -161,12 +190,36 @@ class Cache:
161 if self.cacheValid(fn): 190 if self.cacheValid(fn):
162 if "SKIPPED" in self.depends_cache[fn]: 191 if "SKIPPED" in self.depends_cache[fn]:
163 return True, True 192 return True, True
193 self.handle_data(fn, cacheData)
194 multi = self.getVar('BBCLASSEXTEND', fn, True)
195 if multi:
196 for cls in multi.split():
197 virtualfn = self.realfn2virtual(fn, cls)
198 # Pretend we're clean so getVar works
199 self.clean[virtualfn] = ""
200 self.handle_data(virtualfn, cacheData)
164 return True, False 201 return True, False
165 202
166 bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s" % fn) 203 bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s" % fn)
167 204
168 bb_data, skipped = self.load_bbfile(fn, cfgData) 205 bb_data, skipped = self.load_bbfile(fn, cfgData)
169 self.setData(fn, bb_data) 206
207 if skipped:
208 if isinstance(bb_data, dict):
209 self.setData(fn, fn, bb_data[""])
210 else:
211 self.setData(fn, fn, bb_data)
212 return False, skipped
213
214 if isinstance(bb_data, dict):
215 for data in bb_data:
216 virtualfn = self.realfn2virtual(fn, data)
217 self.setData(virtualfn, fn, bb_data[data])
218 self.handle_data(virtualfn, cacheData)
219 return False, skipped
220
221 self.setData(fn, fn, bb_data)
222 self.handle_data(fn, cacheData)
170 return False, skipped 223 return False, skipped
171 224
172 def cacheValid(self, fn): 225 def cacheValid(self, fn):
@@ -384,6 +437,7 @@ class Cache:
384 437
385 # Touch this to make sure its in the cache 438 # Touch this to make sure its in the cache
386 self.getVar('__BB_DONT_CACHE', file_name, True) 439 self.getVar('__BB_DONT_CACHE', file_name, True)
440 self.getVar('BBCLASSEXTEND', file_name, True)
387 441
388 def load_bbfile( self, bbfile , config): 442 def load_bbfile( self, bbfile , config):
389 """ 443 """