From 17daa2ba6280304771c5fe52b94eb56f0c087490 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 25 Apr 2014 18:21:24 -0300 Subject: bitbake: 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. (Bitbake rev: d1e3345d715e488ec3f5515fb0e1fb39366346bc) Signed-off-by: Otavio Salvador Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 0be45e1af6..1be1874cbc 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/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() -- cgit v1.2.3-54-g00ecf