[bitbake-devel] [PATCH 2/2] bb/utils: fix contains_any()

Ross Burton ross.burton at intel.com
Wed Jun 11 10:04:44 UTC 2014


"set1 in set2" doesn't do what you'd expect, and if it did do a subset test
that's not the logic required by contains_any().

Instead get the intersection of checkvalues and val and check if the resulting
set is empty or not (by evaluating it in a boolean context), which tells us if
there are any elements in common.

Based on a patch by Valentin Popa <valentin.popa at intel.com>.

Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 bitbake/lib/bb/utils.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 96d8218..f62709b 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -851,7 +851,7 @@ def contains_any(variable, checkvalues, truevalue, falsevalue, d):
         checkvalues = set(checkvalues.split())
     else:
         checkvalues = set(checkvalues)
-    if checkvalues in val:
+    if checkvalues & val:
         return truevalue
     return falsevalue
 
-- 
1.7.10.4




More information about the bitbake-devel mailing list