diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-21 14:44:23 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-21 23:09:33 +0000 |
commit | 01c335432524f250ca806381ebcb8a208524eb34 (patch) | |
tree | 0a0849327e2f4b02bb3f1aed55fd631db5a6cd95 /bitbake/lib | |
parent | 2d2d17e13665f767de8b2b0b33f6b2debb174019 (diff) | |
download | poky-01c335432524f250ca806381ebcb8a208524eb34.tar.gz |
bitbake: parse/ast: Add support for BB_RECIPE_VIRTUAL_PROVIDERS
Currently, providers are set on a global config basis. This change allows
for a select set of providers configured in BB_RECIPE_VIRTUAL_PROVIDERS to
be selected on a per recipe basis. This would allow for the selection of
virtual/cross-cc as gcc or clang for example in OE-Core.
DEPENDS and task flag [depends] values are processed.
(Bitbake rev: fb119c7888ae8a749aa824f8c51780176af077f9)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 30ede008d7..290ed45048 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -440,6 +440,30 @@ def runAnonFuncs(d): | |||
440 | code.append("%s(d)" % funcname) | 440 | code.append("%s(d)" % funcname) |
441 | bb.utils.better_exec("\n".join(code), {"d": d}) | 441 | bb.utils.better_exec("\n".join(code), {"d": d}) |
442 | 442 | ||
443 | # Handle recipe level PREFERRED_PROVIDERs | ||
444 | def handleVirtRecipeProviders(tasklist, d): | ||
445 | depends = (d.getVar("DEPENDS") or "").split() | ||
446 | virtprovs = (d.getVar("BB_RECIPE_VIRTUAL_PROVIDERS") or "").split() | ||
447 | newdeps = [] | ||
448 | for dep in depends: | ||
449 | if dep in virtprovs: | ||
450 | newdep = d.getVar("PREFERRED_PROVIDER_" + dep) | ||
451 | if not newdep: | ||
452 | bb.fatal("Error, recipe virtual provider PREFERRED_PROVIDER_%s not set" % dep) | ||
453 | newdeps.append(newdep) | ||
454 | else: | ||
455 | newdeps.append(dep) | ||
456 | d.setVar("DEPENDS", " ".join(newdeps)) | ||
457 | for task in tasklist: | ||
458 | taskdeps = (d.getVarFlag(task, "depends") or "").split() | ||
459 | remapped = [] | ||
460 | for entry in taskdeps: | ||
461 | r, t = entry.split(":") | ||
462 | if r in virtprovs: | ||
463 | r = d.getVar("PREFERRED_PROVIDER_" + r) | ||
464 | remapped.append("%s:%s" % (r, t)) | ||
465 | d.setVarFlag(task, "depends", " ".join(remapped)) | ||
466 | |||
443 | def finalize(fn, d, variant = None): | 467 | def finalize(fn, d, variant = None): |
444 | saved_handlers = bb.event.get_handlers().copy() | 468 | saved_handlers = bb.event.get_handlers().copy() |
445 | try: | 469 | try: |
@@ -465,6 +489,7 @@ def finalize(fn, d, variant = None): | |||
465 | 489 | ||
466 | tasklist = d.getVar('__BBTASKS', False) or [] | 490 | tasklist = d.getVar('__BBTASKS', False) or [] |
467 | bb.event.fire(bb.event.RecipeTaskPreProcess(fn, list(tasklist)), d) | 491 | bb.event.fire(bb.event.RecipeTaskPreProcess(fn, list(tasklist)), d) |
492 | handleVirtRecipeProviders(tasklist, d) | ||
468 | bb.build.add_tasks(tasklist, d) | 493 | bb.build.add_tasks(tasklist, d) |
469 | 494 | ||
470 | bb.parse.siggen.finalise(fn, d, variant) | 495 | bb.parse.siggen.finalise(fn, d, variant) |