[oe] [PATCH 7/9] kernel.bbclass: simplify "if image" condition

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Jan 26 20:29:31 UTC 2011


On Wed, Jan 26, 2011 at 12:52:54PM -0700, Tom Rini wrote:
>On 01/26/2011 12:26 PM, Tom Rini wrote:
>>On 01/26/2011 11:13 AM, Bernhard Reutner-Fischer wrote:
>>>Anything that expands image to any false value should not set
>>>INITRAMFS_TASK (instead of just "" or None).
>>>
>>>Signed-off-by: Bernhard Reutner-Fischer<rep.dot.nop at gmail.com>
>>>---
>>>classes/kernel.bbclass | 2 +-
>>>1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>>diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass
>>>index ea1daf6..d0608e5 100644
>>>--- a/classes/kernel.bbclass
>>>+++ b/classes/kernel.bbclass
>>>@@ -18,7 +18,7 @@ python __anonymous () {
>>>bb.data.setVar("DEPENDS", depends, d)
>>>
>>>image = bb.data.getVar('INITRAMFS_IMAGE', d, True)
>>>- if image != '' and image is not None:
>>>+ if image:
>>>bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d)
>>>
>>>machine_kernel_pr = bb.data.getVar('MACHINE_KERNEL_PR', d, True)
>>
>>Er, right below these lines it still does:
>>INITRAMFS_IMAGE ?= ""
>>INITRAMFS_TASK ?= ""
>>
>>Which would be a problem yes? Or is there some pythonism I'm forgetting?
>
>OK, after some quick IRC conversation, my only concern is the message
>wasn't clear to me, but the changes are fine.  Could it be expanded
>to say:
>Remove some checks because <existing message more or less> means they
>aren't necessary?

Remove superfluous checks since testing for any False, None or empty object
yields False in python.

I'll phrase it like this. Thanks!
>
>Acked-by: Tom Rini <tom_rini at mentor.com>
>




More information about the Openembedded-devel mailing list