diff options
| -rw-r--r-- | meta/classes/distro_features_check.bbclass | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/meta/classes/distro_features_check.bbclass b/meta/classes/distro_features_check.bbclass index 9b78b03ef6..eeaa3b44cb 100644 --- a/meta/classes/distro_features_check.bbclass +++ b/meta/classes/distro_features_check.bbclass | |||
| @@ -11,27 +11,22 @@ | |||
| 11 | 11 | ||
| 12 | python () { | 12 | python () { |
| 13 | # Assume at least one var is set. | 13 | # Assume at least one var is set. |
| 14 | distro_features = (d.getVar('DISTRO_FEATURES') or "").split() | 14 | distro_features = set((d.getVar('DISTRO_FEATURES') or '').split()) |
| 15 | 15 | ||
| 16 | any_of_distro_features = d.getVar('ANY_OF_DISTRO_FEATURES') | 16 | any_of_distro_features = set((d.getVar('ANY_OF_DISTRO_FEATURES') or '').split()) |
| 17 | if any_of_distro_features: | 17 | if any_of_distro_features: |
| 18 | any_of_distro_features = any_of_distro_features.split() | 18 | if set.isdisjoint(any_of_distro_features, distro_features): |
| 19 | if set.isdisjoint(set(any_of_distro_features),set(distro_features)): | 19 | raise bb.parse.SkipRecipe("one of '%s' needs to be in DISTRO_FEATURES" % ' '.join(any_of_distro_features)) |
| 20 | raise bb.parse.SkipRecipe("one of '%s' needs to be in DISTRO_FEATURES" % any_of_distro_features) | ||
| 21 | 20 | ||
| 22 | required_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES') | 21 | required_distro_features = set((d.getVar('REQUIRED_DISTRO_FEATURES') or '').split()) |
| 23 | if required_distro_features: | 22 | if required_distro_features: |
| 24 | required_distro_features = required_distro_features.split() | 23 | missing = set.difference(required_distro_features, distro_features) |
| 25 | for f in required_distro_features: | 24 | if missing: |
| 26 | if f in distro_features: | 25 | raise bb.parse.SkipRecipe("missing required distro feature%s '%s' (not in DISTRO_FEATURES)" % ('s' if len(missing) > 1 else '', ' '.join(missing))) |
| 27 | continue | ||
| 28 | else: | ||
| 29 | raise bb.parse.SkipRecipe("missing required distro feature '%s' (not in DISTRO_FEATURES)" % f) | ||
| 30 | 26 | ||
| 31 | conflict_distro_features = d.getVar('CONFLICT_DISTRO_FEATURES') | 27 | conflict_distro_features = set((d.getVar('CONFLICT_DISTRO_FEATURES') or '').split()) |
| 32 | if conflict_distro_features: | 28 | if conflict_distro_features: |
| 33 | conflict_distro_features = conflict_distro_features.split() | 29 | conflicts = set.intersection(conflict_distro_features, distro_features) |
| 34 | for f in conflict_distro_features: | 30 | if conflicts: |
| 35 | if f in distro_features: | 31 | raise bb.parse.SkipRecipe("conflicting distro feature%s '%s' (in DISTRO_FEATURES)" % ('s' if len(conflicts) > 1 else '', ' '.join(conflicts))) |
| 36 | raise bb.parse.SkipRecipe("conflicting distro feature '%s' (in DISTRO_FEATURES)" % f) | ||
| 37 | } | 32 | } |
