]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
wic: round variable before converting to int
authorEd Bartosh <ed.bartosh@linux.intel.com>
Mon, 7 Sep 2015 10:01:13 +0000 (13:01 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 9 Sep 2015 13:24:57 +0000 (14:24 +0100)
Wic uses bitbake variable ROOTFS_SIZE to set correspondent
partition size. This variable is a literal representing
float value. Wic crashes trying to convert it to int with
the error: invalid literal for int() with base 10: '10166.0'

Fixed this by converting variable to float and rounding result.
This should work for int and float literals.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/imager/direct.py

index 31c0edc7d321b724d5a89018be90038dabd742e4..146a0d1535dcf8cb61ceb60f6835f87555b3458c 100644 (file)
@@ -242,7 +242,7 @@ class DirectImageCreator(BaseImageCreator):
                     rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name)
                     if rsize_bb:
                         # convert from Kb to Mb
-                        part.size = int(rsize_bb) / 1024
+                        part.size = int(round(float(rsize_bb) / 1024.))
             # need to create the filesystems in order to get their
             # sizes before we can add them and do the layout.
             # Image.create() actually calls __format_disks() to create