[oe-commits] Brian Pomerantz : base.bbclass: in base_contains, check for var existance before using it
git version control
git at git.openembedded.org
Sun Jan 24 10:39:20 UTC 2010
Module: openembedded.git
Branch: holger/staging-branch
Commit: 9084c86183c36fdd14ac8cc1c76a3cf888e6eb72
URL: http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=9084c86183c36fdd14ac8cc1c76a3cf888e6eb72
Author: Brian Pomerantz <bapper at mvista.com>
Date: Fri Jan 15 07:36:58 2010 +0000
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 at mvista.com>
Signed-off-by: Chris Larson <clarson at mvista.com>
Acked-by: Khem Raj <raj.khem at gmail.com>
---
classes/base.bbclass | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/classes/base.bbclass b/classes/base.bbclass
index c791b94..7ea15f0 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -226,14 +226,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):
More information about the Openembedded-commits
mailing list