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

Submitted by Ross Burton on June 11, 2014, 10:04 a.m.


Message ID 1402481084-13848-2-git-send-email-ross.burton@intel.com
State New
Headers show

Commit Message

Ross Burton June 11, 2014, 10:04 a.m.
"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@intel.com>.

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

Patch hide | download patch | download mbox

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())
         checkvalues = set(checkvalues)
-    if checkvalues in val:
+    if checkvalues & val:
         return truevalue
     return falsevalue