[oe] [PATCH 3/3] patch.bbclass: use oe_param_bool()

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Thu May 27 12:41:11 UTC 2010


This patch replaces a complicated if statement with a more simple
code.

Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
---
 classes/patch.bbclass |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/classes/patch.bbclass b/classes/patch.bbclass
index 7b0c444..8fe8c00 100644
--- a/classes/patch.bbclass
+++ b/classes/patch.bbclass
@@ -46,15 +46,13 @@ python patch_do_patch() {
 			local = os.path.join(workdir, base)
 			ext = os.path.splitext(base)[1]
 
-		if "apply" in parm:
-			apply = parm["apply"]
-			if apply != "yes":
-				if apply != "no":
-					bb.msg.warn(None, "Unsupported value '%s' for 'apply' url param in '%s', please use 'yes' or 'no'" % (apply, url))
-				continue
+		is_patch = ext in (".diff", ".patch")
+
+		if not oe_param_bool(parm, 'apply', is_patch):
+			continue
 		elif "patch" in parm:
 			bb.msg.warn(None, "Deprecated usage of 'patch' url param in '%s', please use 'apply={yes,no}'" % url)
-		elif ext not in (".diff", ".patch"):
+		elif not is_patch:
 			continue
 
 		if not local:
-- 
1.7.0.1





More information about the Openembedded-devel mailing list