diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-15 22:06:30 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-20 08:31:28 +0000 |
| commit | 3a4aeda0fa67ae4a2f8c79e83c734b45dde95543 (patch) | |
| tree | e420d1a34403c3cc956f79d91a633dcd5c56f797 /bitbake/lib/bb/cookerdata.py | |
| parent | 16ad67809b9b9cc67dfa863de7605126793f31ae (diff) | |
| download | poky-3a4aeda0fa67ae4a2f8c79e83c734b45dde95543.tar.gz | |
bitbake: cache/cookerdata: Move recipe parsing functions from cache to databuilder
When 'NoCache' was written, databuilder/cookerdata didn't exist. It does
now and the recipe parsing functionality contained in NoCache clearly
belongs there, it isn't a cache function. Move those functions, renaming
to match the style in databuilder but otherwise not changing functionality
for now. Fix up the callers to match (which make it clear this is the right
move).
(Bitbake rev: 783879319c6a4cf3639fcbf763b964e42f602eca)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cookerdata.py')
| -rw-r--r-- | bitbake/lib/bb/cookerdata.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index 8a354fed7c..c322ab2ffb 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py | |||
| @@ -466,3 +466,54 @@ class CookerDataBuilder(object): | |||
| 466 | 466 | ||
| 467 | return data | 467 | return data |
| 468 | 468 | ||
| 469 | @staticmethod | ||
| 470 | def _parse_recipe(bb_data, bbfile, appends, mc=''): | ||
| 471 | bb_data.setVar("__BBMULTICONFIG", mc) | ||
| 472 | |||
| 473 | bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) | ||
| 474 | bb.parse.cached_mtime_noerror(bbfile_loc) | ||
| 475 | |||
| 476 | if appends: | ||
| 477 | bb_data.setVar('__BBAPPEND', " ".join(appends)) | ||
| 478 | bb_data = bb.parse.handle(bbfile, bb_data) | ||
| 479 | return bb_data | ||
| 480 | |||
| 481 | def parseRecipeVariants(self, bbfile, appends, virtonly=False, mc=None): | ||
| 482 | """ | ||
| 483 | Load and parse one .bb build file | ||
| 484 | Return the data and whether parsing resulted in the file being skipped | ||
| 485 | """ | ||
| 486 | |||
| 487 | if virtonly: | ||
| 488 | (bbfile, virtual, mc) = bb.cache.virtualfn2realfn(bbfile) | ||
| 489 | bb_data = self.mcdata[mc].createCopy() | ||
| 490 | bb_data.setVar("__ONLYFINALISE", virtual or "default") | ||
| 491 | datastores = self._parse_recipe(bb_data, bbfile, appends, mc) | ||
| 492 | return datastores | ||
| 493 | |||
| 494 | if mc is not None: | ||
| 495 | bb_data = self.mcdata[mc].createCopy() | ||
| 496 | return self._parse_recipe(bb_data, bbfile, appends, mc) | ||
| 497 | |||
| 498 | bb_data = self.data.createCopy() | ||
| 499 | datastores = self._parse_recipe(bb_data, bbfile, appends) | ||
| 500 | |||
| 501 | for mc in self.mcdata: | ||
| 502 | if not mc: | ||
| 503 | continue | ||
| 504 | bb_data = self.mcdata[mc].createCopy() | ||
| 505 | newstores = self._parse_recipe(bb_data, bbfile, appends, mc) | ||
| 506 | for ns in newstores: | ||
| 507 | datastores["mc:%s:%s" % (mc, ns)] = newstores[ns] | ||
| 508 | |||
| 509 | return datastores | ||
| 510 | |||
| 511 | def parseRecipe(self, virtualfn, appends): | ||
| 512 | """ | ||
| 513 | Return a complete set of data for fn. | ||
| 514 | To do this, we need to parse the file. | ||
| 515 | """ | ||
| 516 | logger.debug("Parsing %s (full)" % virtualfn) | ||
| 517 | (fn, virtual, mc) = bb.cache.virtualfn2realfn(virtualfn) | ||
| 518 | bb_data = self.parseRecipeVariants(virtualfn, appends, virtonly=True) | ||
| 519 | return bb_data[virtual] | ||
