diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2014-04-25 18:21:24 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-04-29 23:38:35 +0100 |
commit | d1e3345d715e488ec3f5515fb0e1fb39366346bc (patch) | |
tree | 5552fb02b71688085f92418227c6d15330d8a587 /lib/bb/utils.py | |
parent | 97537e4786a1e3a329249497498b59b8f5174fc3 (diff) | |
download | openembedded-core-contrib-d1e3345d715e488ec3f5515fb0e1fb39366346bc.tar.gz |
bb.utils, bb.codeparser: Add bb.utils.contains_any
This includes contains_any in the special handling code for sstate. It
does not take into account the equivalence of the values. In current
code, considering 'bb.utils.contains_any("A", "foo bar", ...)':
A = "foo"
A = "bar"
A = "foo bar"
All those will get different signatures.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r-- | lib/bb/utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 0be45e1af6..1be1874cbc 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -845,6 +845,19 @@ def contains(variable, checkvalues, truevalue, falsevalue, d): return truevalue return falsevalue +def contains_any(variable, checkvalues, truevalue, falsevalue, d): + val = d.getVar(variable, True) + if not val: + return falsevalue + val = set(val.split()) + if isinstance(checkvalues, basestring): + checkvalues = set(checkvalues.split()) + else: + checkvalues = set(checkvalues) + if checkvalues in val: + return truevalue + return falsevalue + def cpu_count(): return multiprocessing.cpu_count() |