diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 82e5dc4277..075ca88ab5 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -856,3 +856,17 @@ def to_boolean(string, default=None): return False else: raise ValueError("Invalid value for to_boolean: %s" % string) + +def contains(variable, checkvalues, truevalue, falsevalue, d): + val = d.getVar(variable, True) + if not val: + return falsevalue + matches = 0 + if type(checkvalues).__name__ == "str": + checkvalues = [checkvalues] + for value in checkvalues: + if val.find(value) != -1: + matches = matches + 1 + if matches == len(checkvalues): + return truevalue + return falsevalue