[oe-commits] [openembedded-core] 13/14: image.bbclass: use max() instead of indexing booleans

git at git.openembedded.org git at git.openembedded.org
Wed Apr 13 09:14:02 UTC 2016


rpurdie pushed a commit to branch krogoth
in repository openembedded-core.

commit 7ee49f8a41b4b5c48fd283ac2768564c7ebb5332
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Tue Apr 12 11:44:25 2016 +0100

    image.bbclass: use max() instead of indexing booleans
    
    There's some code dotted around OE that uses (a, b)[foo < bar] instead of the
    more idiomatic "test and a or b".  Or in this case, just max().
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/image.bbclass | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index ea77ab8..039feec 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -455,8 +455,7 @@ def get_rootfs_size(d):
                                       d.getVar('IMAGE_ROOTFS', True)])
     size_kb = int(output.split()[0])
     base_size = size_kb * overhead_factor
-    base_size = (base_size, rootfs_req_size)[base_size < rootfs_req_size] + \
-        rootfs_extra_space
+    base_size = max(base_size, rootfs_req_size) + rootfs_extra_space
 
     if base_size != int(base_size):
         base_size = int(base_size + 1)
@@ -544,4 +543,3 @@ do_bundle_initramfs () {
 	:
 }
 addtask bundle_initramfs after do_image_complete
-

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list