aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/partition.py
diff options
context:
space:
mode:
authorMaciej Borzecki <maciej.borzecki@rndity.com>2016-11-10 13:18:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-15 15:19:55 +0000
commitf0181e79eda9102e11ae1ec3e4939ac5fc02cb13 (patch)
treef89783b7ca2f6120a84f1e2f138c858613511b29 /scripts/lib/wic/partition.py
parent81afedc905280f4bfc5fd5f2806a0c6baf657055 (diff)
downloadopenembedded-core-contrib-f0181e79eda9102e11ae1ec3e4939ac5fc02cb13.tar.gz
wic: make sure that partition size is always an integer in internal processing
The size field of Partition class is expected to be an integer and ought to be set inside prepare_*() method. Make sure that this is always the case. (From OE-Core rev: a37838f995ae642b0b8bdd47a605a264fb3bf200) Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/partition.py')
-rw-r--r--scripts/lib/wic/partition.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 89c33ab8b7..959035a971 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -146,6 +146,12 @@ class Partition():
oe_builddir,
bootimg_dir, kernel_dir, rootfs_dir,
native_sysroot)
+ # further processing required Partition.size to be an integer, make
+ # sure that it is one
+ if type(self.size) is not int:
+ msger.error("Partition %s internal size is not an integer. " \
+ "This a bug in source plugin %s and needs to be fixed." \
+ % (self.mountpoint, self.source))
def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir,
rootfs_dir):
@@ -157,7 +163,7 @@ class Partition():
out = exec_cmd(du_cmd)
rootfs_size = out.split()[0]
- self.size = rootfs_size
+ self.size = int(rootfs_size)
self.source_file = rootfs
def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir,
@@ -194,7 +200,7 @@ class Partition():
# get the rootfs size in the right units for kickstart (kB)
du_cmd = "du -Lbks %s" % rootfs
out = exec_cmd(du_cmd)
- self.size = out.split()[0]
+ self.size = int(out.split()[0])
break
@@ -379,7 +385,7 @@ class Partition():
out = exec_cmd(du_cmd)
fs_size = out.split()[0]
- self.size = fs_size
+ self.size = int(fs_size)
def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot):
"""