diff options
author | Maciej Borzecki <maciej.borzecki@rndity.com> | 2016-11-10 13:18:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-15 15:19:55 +0000 |
commit | f0181e79eda9102e11ae1ec3e4939ac5fc02cb13 (patch) | |
tree | f89783b7ca2f6120a84f1e2f138c858613511b29 /scripts | |
parent | 81afedc905280f4bfc5fd5f2806a0c6baf657055 (diff) | |
download | poky-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')
-rw-r--r-- | scripts/lib/wic/partition.py | 12 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/rawcopy.py | 4 |
3 files changed, 12 insertions, 6 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(): | |||
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 | ||
@@ -379,7 +385,7 @@ class Partition(): | |||
379 | out = exec_cmd(du_cmd) | 385 | out = exec_cmd(du_cmd) |
380 | fs_size = out.split()[0] | 386 | fs_size = out.split()[0] |
381 | 387 | ||
382 | self.size = fs_size | 388 | self.size = int(fs_size) |
383 | 389 | ||
384 | def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): | 390 | def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): |
385 | """ | 391 | """ |
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 8bc362254d..4adb80becc 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py | |||
@@ -234,5 +234,5 @@ class BootimgEFIPlugin(SourcePlugin): | |||
234 | out = exec_cmd(du_cmd) | 234 | out = exec_cmd(du_cmd) |
235 | bootimg_size = out.split()[0] | 235 | bootimg_size = out.split()[0] |
236 | 236 | ||
237 | part.size = bootimg_size | 237 | part.size = int(bootimg_size) |
238 | part.source_file = bootimg | 238 | part.source_file = bootimg |
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index e0b11f95ad..5bd22fdeb5 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py | |||
@@ -78,9 +78,9 @@ class RawCopyPlugin(SourcePlugin): | |||
78 | # get the size in the right units for kickstart (kB) | 78 | # get the size in the right units for kickstart (kB) |
79 | du_cmd = "du -Lbks %s" % dst | 79 | du_cmd = "du -Lbks %s" % dst |
80 | out = exec_cmd(du_cmd) | 80 | out = exec_cmd(du_cmd) |
81 | filesize = out.split()[0] | 81 | filesize = int(out.split()[0]) |
82 | 82 | ||
83 | if int(filesize) > int(part.size): | 83 | if filesize > part.size: |
84 | part.size = filesize | 84 | part.size = filesize |
85 | 85 | ||
86 | part.source_file = dst | 86 | part.source_file = dst |