summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-11 14:38:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-22 12:12:35 +0100
commitac704918e4e3a43bab7305464cfc11d6a8975fb6 (patch)
tree26c486c93e7a4900d5545999475dffb1754b8d20 /bitbake/lib
parent14f3bab4d10503d59a3e938d3e17f41f96686edf (diff)
downloadpoky-ac704918e4e3a43bab7305464cfc11d6a8975fb6.tar.gz
bitbake/utils: Add contains helper function from lib.oe.utils
This function is needed by some of the early .conf setup we need to improve the machine/tune files in Openembedded. We need to add it here since the location in oe.utils can't be accessed until after base.bbclass parses which is too late for our needs. (Bitbake rev: abc67ed6921c98ed581f101ec1acc589fd9ce7e9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/utils.py14
1 files changed, 14 insertions, 0 deletions
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):
856 return False 856 return False
857 else: 857 else:
858 raise ValueError("Invalid value for to_boolean: %s" % string) 858 raise ValueError("Invalid value for to_boolean: %s" % string)
859
860def contains(variable, checkvalues, truevalue, falsevalue, d):
861 val = d.getVar(variable, True)
862 if not val:
863 return falsevalue
864 matches = 0
865 if type(checkvalues).__name__ == "str":
866 checkvalues = [checkvalues]
867 for value in checkvalues:
868 if val.find(value) != -1:
869 matches = matches + 1
870 if matches == len(checkvalues):
871 return truevalue
872 return falsevalue