aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Pomerantz <bapper@mvista.com>2010-01-15 07:36:58 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-01-28 14:21:25 +0100
commita2967ad7d1c381239a2b39d8724b99e1bafdf49f (patch)
tree4b0c4f90ae5084611ec2de8f2995838d812a6dcd
parent67f8c8766f4578cfc217b0f2594011086ffe80f1 (diff)
downloadopenembedded-a2967ad7d1c381239a2b39d8724b99e1bafdf49f.tar.gz
base.bbclass: in base_contains, check for var existance before using it
When using base_contains() to check for a string in a variable for a, if the variable is not defined an exception occurs. By checking the existance of the variable and returning false if it isn't there, a value can be checked for a variable regardless of whether or not it is defined. Signed-off-by: Brian Pomerantz <bapper@mvista.com> Signed-off-by: Chris Larson <clarson@mvista.com> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
-rw-r--r--classes/base.bbclass7
1 files changed, 5 insertions, 2 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 277b4e2b8e..933168a6bb 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -244,14 +244,17 @@ def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
return falsevalue
def base_contains(variable, checkvalues, truevalue, falsevalue, d):
+ val = bb.data.getVar(variable,d,1)
+ if not val:
+ return falsevalue
matches = 0
if type(checkvalues).__name__ == "str":
checkvalues = [checkvalues]
for value in checkvalues:
- if bb.data.getVar(variable,d,1).find(value) != -1:
+ if val.find(value) != -1:
matches = matches + 1
if matches == len(checkvalues):
- return truevalue
+ return truevalue
return falsevalue
def base_both_contain(variable1, variable2, checkvalue, d):