diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-12-08 00:38:17 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-12-08 00:38:17 +0300 |
commit | 8d6ae7f2a817751fad151168fa10ce28ee0869d8 (patch) | |
tree | 281032f7ec07c41589aa094bd165cc2a98f2d3a7 /poky/meta/classes/features_check.bbclass | |
parent | c16fb8893b19075db4bcf3b5bf33c1db8c3ca2bd (diff) | |
parent | 5da3c2284560a7e08ffafd03c5b5ba44a3242228 (diff) | |
download | openbmc-8d6ae7f2a817751fad151168fa10ce28ee0869d8.tar.xz |
Merge tag '0.26' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into update
Diffstat (limited to 'poky/meta/classes/features_check.bbclass')
-rw-r--r-- | poky/meta/classes/features_check.bbclass | 125 |
1 files changed, 47 insertions, 78 deletions
diff --git a/poky/meta/classes/features_check.bbclass b/poky/meta/classes/features_check.bbclass index 876d32e31..b3c804786 100644 --- a/poky/meta/classes/features_check.bbclass +++ b/poky/meta/classes/features_check.bbclass @@ -1,23 +1,13 @@ -# Allow checking of required and conflicting DISTRO_FEATURES +# Allow checking of required and conflicting features # -# ANY_OF_DISTRO_FEATURES: ensure at least one item on this list is included -# in DISTRO_FEATURES. -# REQUIRED_DISTRO_FEATURES: ensure every item on this list is included -# in DISTRO_FEATURES. -# CONFLICT_DISTRO_FEATURES: ensure no item in this list is included in -# DISTRO_FEATURES. -# ANY_OF_MACHINE_FEATURES: ensure at least one item on this list is included -# in MACHINE_FEATURES. -# REQUIRED_MACHINE_FEATURES: ensure every item on this list is included -# in MACHINE_FEATURES. -# CONFLICT_MACHINE_FEATURES: ensure no item in this list is included in -# MACHINE_FEATURES. -# ANY_OF_COMBINED_FEATURES: ensure at least one item on this list is included -# in COMBINED_FEATURES. -# REQUIRED_COMBINED_FEATURES: ensure every item on this list is included -# in COMBINED_FEATURES. -# CONFLICT_COMBINED_FEATURES: ensure no item in this list is included in -# COMBINED_FEATURES. +# xxx = [DISTRO,MACHINE,COMBINED] +# +# ANY_OF_xxx_FEATURES: ensure at least one item on this list is included +# in xxx_FEATURES. +# REQUIRED_xxx_FEATURES: ensure every item on this list is included +# in xxx_FEATURES. +# CONFLICT_xxx_FEATURES: ensure no item in this list is included in +# xxx_FEATURES. # # Copyright 2019 (C) Texas Instruments Inc. # Copyright 2013 (C) O.S. Systems Software LTDA. @@ -26,63 +16,42 @@ python () { if d.getVar('PARSE_ALL_RECIPES', False): return - # Assume at least one var is set. - distro_features = set((d.getVar('DISTRO_FEATURES') or '').split()) - - any_of_distro_features = set((d.getVar('ANY_OF_DISTRO_FEATURES') or '').split()) - if any_of_distro_features: - if set.isdisjoint(any_of_distro_features, distro_features): - raise bb.parse.SkipRecipe("one of '%s' needs to be in DISTRO_FEATURES" % ' '.join(any_of_distro_features)) - - required_distro_features = set((d.getVar('REQUIRED_DISTRO_FEATURES') or '').split()) - if required_distro_features: - missing = set.difference(required_distro_features, distro_features) - if missing: - raise bb.parse.SkipRecipe("missing required distro feature%s '%s' (not in DISTRO_FEATURES)" % ('s' if len(missing) > 1 else '', ' '.join(missing))) - - conflict_distro_features = set((d.getVar('CONFLICT_DISTRO_FEATURES') or '').split()) - if conflict_distro_features: - conflicts = set.intersection(conflict_distro_features, distro_features) - if conflicts: - raise bb.parse.SkipRecipe("conflicting distro feature%s '%s' (in DISTRO_FEATURES)" % ('s' if len(conflicts) > 1 else '', ' '.join(conflicts))) - - # Assume at least one var is set. - machine_features = set((d.getVar('MACHINE_FEATURES') or '').split()) - - any_of_machine_features = set((d.getVar('ANY_OF_MACHINE_FEATURES') or '').split()) - if any_of_machine_features: - if set.isdisjoint(any_of_machine_features, machine_features): - raise bb.parse.SkipRecipe("one of '%s' needs to be in MACHINE_FEATURES" % ' '.join(any_of_machine_features)) - - required_machine_features = set((d.getVar('REQUIRED_MACHINE_FEATURES') or '').split()) - if required_machine_features: - missing = set.difference(required_machine_features, machine_features) - if missing: - raise bb.parse.SkipRecipe("missing required machine feature%s '%s' (not in MACHINE_FEATURES)" % ('s' if len(missing) > 1 else '', ' '.join(missing))) - - conflict_machine_features = set((d.getVar('CONFLICT_MACHINE_FEATURES') or '').split()) - if conflict_machine_features: - conflicts = set.intersection(conflict_machine_features, machine_features) - if conflicts: - raise bb.parse.SkipRecipe("conflicting machine feature%s '%s' (in MACHINE_FEATURES)" % ('s' if len(conflicts) > 1 else '', ' '.join(conflicts))) - - # Assume at least one var is set. - combined_features = set((d.getVar('COMBINED_FEATURES') or '').split()) - - any_of_combined_features = set((d.getVar('ANY_OF_COMBINED_FEATURES') or '').split()) - if any_of_combined_features: - if set.isdisjoint(any_of_combined_features, combined_features): - raise bb.parse.SkipRecipe("one of '%s' needs to be in COMBINED_FEATURES" % ' '.join(any_of_combined_features)) - - required_combined_features = set((d.getVar('REQUIRED_COMBINED_FEATURES') or '').split()) - if required_combined_features: - missing = set.difference(required_combined_features, combined_features) - if missing: - raise bb.parse.SkipRecipe("missing required machine feature%s '%s' (not in COMBINED_FEATURES)" % ('s' if len(missing) > 1 else '', ' '.join(missing))) - - conflict_combined_features = set((d.getVar('CONFLICT_COMBINED_FEATURES') or '').split()) - if conflict_combined_features: - conflicts = set.intersection(conflict_combined_features, combined_features) - if conflicts: - raise bb.parse.SkipRecipe("conflicting machine feature%s '%s' (in COMBINED_FEATURES)" % ('s' if len(conflicts) > 1 else '', ' '.join(conflicts))) + unused = True + + for kind in ['DISTRO', 'MACHINE', 'COMBINED']: + if d.getVar('ANY_OF_' + kind + '_FEATURES') is None and \ + d.overridedata.get('ANY_OF_' + kind + '_FEATURES') is None and \ + d.getVar('REQUIRED_' + kind + '_FEATURES') is None and \ + d.overridedata.get('REQUIRED_' + kind + '_FEATURES') is None and \ + d.getVar('CONFLICT_' + kind + '_FEATURES') is None and \ + d.overridedata.get('CONFLICT_' + kind + '_FEATURES') is None: + continue + + unused = False + + # Assume at least one var is set. + features = set((d.getVar(kind + '_FEATURES') or '').split()) + + any_of_features = set((d.getVar('ANY_OF_' + kind + '_FEATURES') or '').split()) + if any_of_features: + if set.isdisjoint(any_of_features, features): + raise bb.parse.SkipRecipe("one of '%s' needs to be in %s_FEATURES" + % (' '.join(any_of_features), kind)) + + required_features = set((d.getVar('REQUIRED_' + kind + '_FEATURES') or '').split()) + if required_features: + missing = set.difference(required_features, features) + if missing: + raise bb.parse.SkipRecipe("missing required %s feature%s '%s' (not in %s_FEATURES)" + % (kind.lower(), 's' if len(missing) > 1 else '', ' '.join(missing), kind)) + + conflict_features = set((d.getVar('CONFLICT_' + kind + '_FEATURES') or '').split()) + if conflict_features: + conflicts = set.intersection(conflict_features, features) + if conflicts: + raise bb.parse.SkipRecipe("conflicting %s feature%s '%s' (in %s_FEATURES)" + % (kind.lower(), 's' if len(conflicts) > 1 else '', ' '.join(conflicts), kind)) + + if unused: + bb.warn("Recipe inherits features_check but doesn't use it") } |