summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cache.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r--bitbake/lib/bb/cache.py53
1 files changed, 42 insertions, 11 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 5f302d68b4..0d5a034b53 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -248,6 +248,11 @@ def virtualfn2realfn(virtualfn):
248 """ 248 """
249 Convert a virtual file name to a real one + the associated subclass keyword 249 Convert a virtual file name to a real one + the associated subclass keyword
250 """ 250 """
251 mc = ""
252 if virtualfn.startswith('multiconfig:'):
253 elems = virtualfn.split(':')
254 mc = elems[1]
255 virtualfn = ":".join(elems[2:])
251 256
252 fn = virtualfn 257 fn = virtualfn
253 cls = "" 258 cls = ""
@@ -255,15 +260,32 @@ def virtualfn2realfn(virtualfn):
255 elems = virtualfn.split(':') 260 elems = virtualfn.split(':')
256 cls = ":".join(elems[1:-1]) 261 cls = ":".join(elems[1:-1])
257 fn = elems[-1] 262 fn = elems[-1]
258 return (fn, cls)
259 263
260def realfn2virtual(realfn, cls): 264 return (fn, cls, mc)
265
266def realfn2virtual(realfn, cls, mc):
267 """
268 Convert a real filename + the associated subclass keyword to a virtual filename
269 """
270 if cls:
271 realfn = "virtual:" + cls + ":" + realfn
272 if mc:
273 realfn = "multiconfig:" + mc + ":" + realfn
274 return realfn
275
276def variant2virtual(realfn, variant):
261 """ 277 """
262 Convert a real filename + the associated subclass keyword to a virtual filename 278 Convert a real filename + the associated subclass keyword to a virtual filename
263 """ 279 """
264 if cls == "": 280 if variant == "":
265 return realfn 281 return realfn
266 return "virtual:" + cls + ":" + realfn 282 if variant.startswith("multiconfig:"):
283 elems = variant.split(":")
284 if elems[2]:
285 return "multiconfig:" + elems[1] + ":virtual:" + ":".join(elems[2:]) + ":" + realfn
286 return "multiconfig:" + elems[1] + ":" + realfn
287 return "virtual:" + variant + ":" + realfn
288
267 289
268class NoCache(object): 290class NoCache(object):
269 291
@@ -277,7 +299,7 @@ class NoCache(object):
277 To do this, we need to parse the file. 299 To do this, we need to parse the file.
278 """ 300 """
279 logger.debug(1, "Parsing %s (full)" % virtualfn) 301 logger.debug(1, "Parsing %s (full)" % virtualfn)
280 (fn, virtual) = virtualfn2realfn(virtualfn) 302 (fn, virtual, mc) = virtualfn2realfn(virtualfn)
281 bb_data = self.load_bbfile(virtualfn, appends, virtonly=True) 303 bb_data = self.load_bbfile(virtualfn, appends, virtonly=True)
282 return bb_data[virtual] 304 return bb_data[virtual]
283 305
@@ -288,8 +310,8 @@ class NoCache(object):
288 """ 310 """
289 311
290 if virtonly: 312 if virtonly:
291 (bbfile, virtual) = virtualfn2realfn(bbfile) 313 (bbfile, virtual, mc) = virtualfn2realfn(bbfile)
292 bb_data = self.data.createCopy() 314 bb_data = self.databuilder.mcdata[mc].createCopy()
293 bb_data.setVar("__BBMULTICONFIG", mc) 315 bb_data.setVar("__BBMULTICONFIG", mc)
294 bb_data.setVar("__ONLYFINALISE", virtual or "default") 316 bb_data.setVar("__ONLYFINALISE", virtual or "default")
295 datastores = self._load_bbfile(bb_data, bbfile, appends) 317 datastores = self._load_bbfile(bb_data, bbfile, appends)
@@ -298,6 +320,15 @@ class NoCache(object):
298 bb_data = self.data.createCopy() 320 bb_data = self.data.createCopy()
299 datastores = self._load_bbfile(bb_data, bbfile, appends) 321 datastores = self._load_bbfile(bb_data, bbfile, appends)
300 322
323 for mc in self.databuilder.mcdata:
324 if not mc:
325 continue
326 bb_data = self.databuilder.mcdata[mc].createCopy()
327 bb_data.setVar("__BBMULTICONFIG", mc)
328 newstores = self._load_bbfile(bb_data, bbfile, appends)
329 for ns in newstores:
330 datastores["multiconfig:%s:%s" % (mc, ns)] = newstores[ns]
331
301 return datastores 332 return datastores
302 333
303 def _load_bbfile(self, bb_data, bbfile, appends): 334 def _load_bbfile(self, bb_data, bbfile, appends):
@@ -451,7 +482,7 @@ class Cache(NoCache):
451 for variant, data in sorted(datastores.items(), 482 for variant, data in sorted(datastores.items(),
452 key=lambda i: i[0], 483 key=lambda i: i[0],
453 reverse=True): 484 reverse=True):
454 virtualfn = realfn2virtual(filename, variant) 485 virtualfn = variant2virtual(filename, variant)
455 variants.append(variant) 486 variants.append(variant)
456 depends = depends + (data.getVar("__depends", False) or []) 487 depends = depends + (data.getVar("__depends", False) or [])
457 if depends and not variant: 488 if depends and not variant:
@@ -480,7 +511,7 @@ class Cache(NoCache):
480 # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo] 511 # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo]
481 info_array = self.depends_cache[filename] 512 info_array = self.depends_cache[filename]
482 for variant in info_array[0].variants: 513 for variant in info_array[0].variants:
483 virtualfn = realfn2virtual(filename, variant) 514 virtualfn = variant2virtual(filename, variant)
484 infos.append((virtualfn, self.depends_cache[virtualfn])) 515 infos.append((virtualfn, self.depends_cache[virtualfn]))
485 else: 516 else:
486 return self.parse(filename, appends, configdata, self.caches_array) 517 return self.parse(filename, appends, configdata, self.caches_array)
@@ -601,7 +632,7 @@ class Cache(NoCache):
601 632
602 invalid = False 633 invalid = False
603 for cls in info_array[0].variants: 634 for cls in info_array[0].variants:
604 virtualfn = realfn2virtual(fn, cls) 635 virtualfn = variant2virtual(fn, cls)
605 self.clean.add(virtualfn) 636 self.clean.add(virtualfn)
606 if virtualfn not in self.depends_cache: 637 if virtualfn not in self.depends_cache:
607 logger.debug(2, "Cache: %s is not cached", virtualfn) 638 logger.debug(2, "Cache: %s is not cached", virtualfn)
@@ -613,7 +644,7 @@ class Cache(NoCache):
613 # If any one of the variants is not present, mark as invalid for all 644 # If any one of the variants is not present, mark as invalid for all
614 if invalid: 645 if invalid:
615 for cls in info_array[0].variants: 646 for cls in info_array[0].variants:
616 virtualfn = realfn2virtual(fn, cls) 647 virtualfn = variant2virtual(fn, cls)
617 if virtualfn in self.clean: 648 if virtualfn in self.clean:
618 logger.debug(2, "Cache: Removing %s from cache", virtualfn) 649 logger.debug(2, "Cache: Removing %s from cache", virtualfn)
619 self.clean.remove(virtualfn) 650 self.clean.remove(virtualfn)