Create a new function to help match RISC-V ISA extension combinations against recognized profile strings (e.g. 'rva22u64'), so that we can use simpler patterns for naming things like sstate/build paths.
Signed-off-by: Trevor Gamblin <[email protected]> --- meta/lib/oe/tune.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/meta/lib/oe/tune.py b/meta/lib/oe/tune.py index 7296f39e66..0d8e4417e7 100644 --- a/meta/lib/oe/tune.py +++ b/meta/lib/oe/tune.py @@ -90,3 +90,32 @@ def riscv_isa_to_tune(isa): # Eliminate duplicates, but preserve the order feature = list(dict.fromkeys(feature)) return ' '.join(feature) + +# riscv_pkgarch(features, exact_pkgarch) +# +# Prefer a RISCV_PROFILES name (plus any extensions enabled on top of it) as the +# package arch fragment, since otherwise the full ISA extension list will exceed +# what the sstate class can handle. When several profiles match, the one with +# the most extensions is preferred, as it is the more specific/clearer match. +# If there's no clear profile matching the extension list, then fall back to +# exact_pkgarch. +def riscv_pkgarch(features, exact_pkgarch): + if not features: + return exact_pkgarch + + current = set(features.split()) + + best_match = None + best_features = None + for name in RISCV_PROFILES: + profile_features = set(riscv_isa_to_tune(name).split()) + if profile_features.issubset(current): + if best_features is None or len(profile_features) > len(best_features): + best_match = name + best_features = profile_features + + if best_match is None: + return exact_pkgarch + + extra = sorted(current - best_features) + return '_'.join([best_match] + extra) -- 2.55.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#245888): https://lists.openembedded.org/g/openembedded-core/message/245888 Mute This Topic: https://lists.openembedded.org/mt/121267447/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
