diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-16 12:11:29 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-20 08:31:28 +0000 |
commit | 9206614d79a91d92b1130dd028ea0cf3a4bee79f (patch) | |
tree | 516aae7097ba8f4de4da9198697814c04bd2cbbf /bitbake/lib/bb/cache.py | |
parent | 3a4aeda0fa67ae4a2f8c79e83c734b45dde95543 (diff) | |
download | poky-9206614d79a91d92b1130dd028ea0cf3a4bee79f.tar.gz |
bitbake: cache: Drop broken/unused code
Some parts of functions in Cache() were broken and unused, there was
also a totally unused function. This was historical as a result of the
cooker parsing process needing to handle cached entries in the main
thread but parsing actions in seperate processes.
Document the way it works, update the function name to be clear about
what it now does and drop the old code which was unused.
(Bitbake rev: af83ee32df85c8e4144f022a1f58493eb72cb18e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r-- | bitbake/lib/bb/cache.py | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 4d715e911d..22ca6f56e6 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -280,7 +280,11 @@ def variant2virtual(realfn, variant): | |||
280 | return "mc:" + elems[1] + ":" + realfn | 280 | return "mc:" + elems[1] + ":" + realfn |
281 | return "virtual:" + variant + ":" + realfn | 281 | return "virtual:" + variant + ":" + realfn |
282 | 282 | ||
283 | 283 | # | |
284 | # Cooker calls cacheValid on its recipe list, then either calls loadCached | ||
285 | # from it's main thread or parse from separate processes to generate an up to | ||
286 | # date cache | ||
287 | # | ||
284 | class Cache(object): | 288 | class Cache(object): |
285 | """ | 289 | """ |
286 | BitBake Cache implementation | 290 | BitBake Cache implementation |
@@ -447,43 +451,19 @@ class Cache(object): | |||
447 | 451 | ||
448 | return infos | 452 | return infos |
449 | 453 | ||
450 | def load(self, filename, appends): | 454 | def loadCached(self, filename, appends): |
451 | """Obtain the recipe information for the specified filename, | 455 | """Obtain the recipe information for the specified filename, |
452 | using cached values if available, otherwise parsing. | 456 | using cached values. |
453 | 457 | """ | |
454 | Note that if it does parse to obtain the info, it will not | 458 | |
455 | automatically add the information to the cache or to your | 459 | infos = [] |
456 | CacheData. Use the add or add_info method to do so after | 460 | # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo] |
457 | running this, or use loadData instead.""" | 461 | info_array = self.depends_cache[filename] |
458 | cached = self.cacheValid(filename, appends) | 462 | for variant in info_array[0].variants: |
459 | if cached: | 463 | virtualfn = variant2virtual(filename, variant) |
460 | infos = [] | 464 | infos.append((virtualfn, self.depends_cache[virtualfn])) |
461 | # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo] | 465 | |
462 | info_array = self.depends_cache[filename] | 466 | return infos |
463 | for variant in info_array[0].variants: | ||
464 | virtualfn = variant2virtual(filename, variant) | ||
465 | infos.append((virtualfn, self.depends_cache[virtualfn])) | ||
466 | else: | ||
467 | return self.parse(filename, appends, configdata, self.caches_array) | ||
468 | |||
469 | return cached, infos | ||
470 | |||
471 | def loadData(self, fn, appends, cacheData): | ||
472 | """Load the recipe info for the specified filename, | ||
473 | parsing and adding to the cache if necessary, and adding | ||
474 | the recipe information to the supplied CacheData instance.""" | ||
475 | skipped, virtuals = 0, 0 | ||
476 | |||
477 | cached, infos = self.load(fn, appends) | ||
478 | for virtualfn, info_array in infos: | ||
479 | if info_array[0].skipped: | ||
480 | self.logger.debug("Skipping %s: %s", virtualfn, info_array[0].skipreason) | ||
481 | skipped += 1 | ||
482 | else: | ||
483 | self.add_info(virtualfn, info_array, cacheData, not cached) | ||
484 | virtuals += 1 | ||
485 | |||
486 | return cached, skipped, virtuals | ||
487 | 467 | ||
488 | def cacheValid(self, fn, appends): | 468 | def cacheValid(self, fn, appends): |
489 | """ | 469 | """ |