summaryrefslogtreecommitdiffstats
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>2017-01-11 17:21:42 +0000
commit0c5596e5d34b368d6aad84636543d154618ef639 (patch)
tree631b646ff072e72891c4320a0691c66c43648e42 /scripts/lib/wic/partition.py
parent25cd713c4402725eb724cf51ff1c709d2bcbc12b (diff)
downloadpoky-0c5596e5d34b368d6aad84636543d154618ef639.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) (From OE-Core rev: 4e869343952aef8748b40e538c14ad8b94221910) 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> Signed-off-by: Armin Kuster <akuster808@gmail.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 90f65a1e39..30bb05a249 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -146,6 +146,12 @@ class Partition():
146 oe_builddir, 146 oe_builddir,
147 bootimg_dir, kernel_dir, rootfs_dir, 147 bootimg_dir, kernel_dir, rootfs_dir,
148 native_sysroot) 148 native_sysroot)
149 # further processing required Partition.size to be an integer, make
150 # sure that it is one
151 if type(self.size) is not int:
152 msger.error("Partition %s internal size is not an integer. " \
153 "This a bug in source plugin %s and needs to be fixed." \
154 % (self.mountpoint, self.source))
149 155
150 def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir, 156 def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir,
151 rootfs_dir): 157 rootfs_dir):
@@ -157,7 +163,7 @@ class Partition():
157 out = exec_cmd(du_cmd) 163 out = exec_cmd(du_cmd)
158 rootfs_size = out.split()[0] 164 rootfs_size = out.split()[0]
159 165
160 self.size = rootfs_size 166 self.size = int(rootfs_size)
161 self.source_file = rootfs 167 self.source_file = rootfs
162 168
163 def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir, 169 def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir,
@@ -194,7 +200,7 @@ class Partition():
194 # get the rootfs size in the right units for kickstart (kB) 200 # get the rootfs size in the right units for kickstart (kB)
195 du_cmd = "du -Lbks %s" % rootfs 201 du_cmd = "du -Lbks %s" % rootfs
196 out = exec_cmd(du_cmd) 202 out = exec_cmd(du_cmd)
197 self.size = out.split()[0] 203 self.size = int(out.split()[0])
198 204
199 break 205 break
200 206
@@ -375,7 +381,7 @@ class Partition():
375 out = exec_cmd(du_cmd) 381 out = exec_cmd(du_cmd)
376 fs_size = out.split()[0] 382 fs_size = out.split()[0]
377 383
378 self.size = fs_size 384 self.size = int(fs_size)
379 385
380 def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): 386 def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot):
381 """ 387 """