summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/kickstart/custom_commands/partition.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2014-07-31 13:55:24 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-11 10:53:08 +0100
commit68e6adf2df70c3f83d67dc869b3ce989a6902b80 (patch)
treea650dc42d1ae3db2bd7cf3219a252306376d34e5 /scripts/lib/mic/kickstart/custom_commands/partition.py
parent963604605c0eff8c5b6ca6614b6c5fba8ae4dd15 (diff)
downloadpoky-68e6adf2df70c3f83d67dc869b3ce989a6902b80.tar.gz
wic: Make exec_cmd() error out instead of warn
The reason exec_cmd() warns but doesn't error out (broken parted) doesn't really make sense, since the parted invocations don't even use exec_cmd(). It really should just fail since by not doing so it's actually enabling invalid images in some cases. Also, since the return code is now always zero, there's no point in having a return code, so remove it. This represents a change in the API, so we also need to update all callers. (From OE-Core rev: a10bbd39eee29cc49d258bf08aaec279c3115c66) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/mic/kickstart/custom_commands/partition.py')
-rw-r--r--scripts/lib/mic/kickstart/custom_commands/partition.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
index 3b652b399c..101b90ef10 100644
--- a/scripts/lib/mic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
@@ -161,7 +161,7 @@ class Wic_PartData(Mic_PartData):
161 """ 161 """
162 rootfs = oe_builddir 162 rootfs = oe_builddir
163 du_cmd = "du -Lbms %s" % rootfs 163 du_cmd = "du -Lbms %s" % rootfs
164 rc, out = exec_cmd(du_cmd) 164 out = exec_cmd(du_cmd)
165 rootfs_size = out.split()[0] 165 rootfs_size = out.split()[0]
166 166
167 self.size = rootfs_size 167 self.size = rootfs_size
@@ -209,7 +209,7 @@ class Wic_PartData(Mic_PartData):
209 rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype) 209 rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
210 210
211 du_cmd = "du -ks %s" % image_rootfs 211 du_cmd = "du -ks %s" % image_rootfs
212 rc, out = exec_cmd(du_cmd) 212 out = exec_cmd(du_cmd)
213 actual_rootfs_size = int(out.split()[0]) 213 actual_rootfs_size = int(out.split()[0])
214 214
215 extra_blocks = self.get_extra_block_count(actual_rootfs_size) 215 extra_blocks = self.get_extra_block_count(actual_rootfs_size)
@@ -224,18 +224,18 @@ class Wic_PartData(Mic_PartData):
224 224
225 dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \ 225 dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \
226 (rootfs, rootfs_size) 226 (rootfs, rootfs_size)
227 rc, out = exec_cmd(dd_cmd) 227 exec_cmd(dd_cmd)
228 228
229 extra_imagecmd = "-i 8192" 229 extra_imagecmd = "-i 8192"
230 230
231 mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \ 231 mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
232 (self.fstype, extra_imagecmd, rootfs, image_rootfs) 232 (self.fstype, extra_imagecmd, rootfs, image_rootfs)
233 rc, out = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) 233 exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
234 234
235 235
236 # get the rootfs size in the right units for kickstart (Mb) 236 # get the rootfs size in the right units for kickstart (Mb)
237 du_cmd = "du -Lbms %s" % rootfs 237 du_cmd = "du -Lbms %s" % rootfs
238 rc, out = exec_cmd(du_cmd) 238 out = exec_cmd(du_cmd)
239 rootfs_size = out.split()[0] 239 rootfs_size = out.split()[0]
240 240
241 self.size = rootfs_size 241 self.size = rootfs_size
@@ -254,7 +254,7 @@ class Wic_PartData(Mic_PartData):
254 rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype) 254 rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
255 255
256 du_cmd = "du -ks %s" % image_rootfs 256 du_cmd = "du -ks %s" % image_rootfs
257 rc, out = exec_cmd(du_cmd) 257 out = exec_cmd(du_cmd)
258 actual_rootfs_size = int(out.split()[0]) 258 actual_rootfs_size = int(out.split()[0])
259 259
260 extra_blocks = self.get_extra_block_count(actual_rootfs_size) 260 extra_blocks = self.get_extra_block_count(actual_rootfs_size)
@@ -269,15 +269,15 @@ class Wic_PartData(Mic_PartData):
269 269
270 dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \ 270 dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \
271 (rootfs, rootfs_size) 271 (rootfs, rootfs_size)
272 rc, out = exec_cmd(dd_cmd) 272 exec_cmd(dd_cmd)
273 273
274 mkfs_cmd = "mkfs.%s -b %d -r %s %s" % \ 274 mkfs_cmd = "mkfs.%s -b %d -r %s %s" % \
275 (self.fstype, rootfs_size * 1024, image_rootfs, rootfs) 275 (self.fstype, rootfs_size * 1024, image_rootfs, rootfs)
276 rc, out = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) 276 exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
277 277
278 # get the rootfs size in the right units for kickstart (Mb) 278 # get the rootfs size in the right units for kickstart (Mb)
279 du_cmd = "du -Lbms %s" % rootfs 279 du_cmd = "du -Lbms %s" % rootfs
280 rc, out = exec_cmd(du_cmd) 280 out = exec_cmd(du_cmd)
281 rootfs_size = out.split()[0] 281 rootfs_size = out.split()[0]
282 282
283 self.size = rootfs_size 283 self.size = rootfs_size
@@ -292,7 +292,7 @@ class Wic_PartData(Mic_PartData):
292 rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype) 292 rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
293 293
294 du_cmd = "du -bks %s" % image_rootfs 294 du_cmd = "du -bks %s" % image_rootfs
295 rc, out = exec_cmd(du_cmd) 295 out = exec_cmd(du_cmd)
296 blocks = int(out.split()[0]) 296 blocks = int(out.split()[0])
297 297
298 extra_blocks = self.get_extra_block_count(blocks) 298 extra_blocks = self.get_extra_block_count(blocks)
@@ -324,7 +324,7 @@ class Wic_PartData(Mic_PartData):
324 324
325 # get the rootfs size in the right units for kickstart (Mb) 325 # get the rootfs size in the right units for kickstart (Mb)
326 du_cmd = "du -Lbms %s" % rootfs 326 du_cmd = "du -Lbms %s" % rootfs
327 rc, out = exec_cmd(du_cmd) 327 out = exec_cmd(du_cmd)
328 rootfs_size = out.split()[0] 328 rootfs_size = out.split()[0]
329 329
330 self.set_size(rootfs_size) 330 self.set_size(rootfs_size)
@@ -340,11 +340,11 @@ class Wic_PartData(Mic_PartData):
340 340
341 squashfs_cmd = "mksquashfs %s %s -noappend" % \ 341 squashfs_cmd = "mksquashfs %s %s -noappend" % \
342 (image_rootfs, rootfs) 342 (image_rootfs, rootfs)
343 rc, out = exec_native_cmd(pseudo + squashfs_cmd, native_sysroot) 343 exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
344 344
345 # get the rootfs size in the right units for kickstart (Mb) 345 # get the rootfs size in the right units for kickstart (Mb)
346 du_cmd = "du -Lbms %s" % rootfs 346 du_cmd = "du -Lbms %s" % rootfs
347 rc, out = exec_cmd(du_cmd) 347 out = exec_cmd(du_cmd)
348 rootfs_size = out.split()[0] 348 rootfs_size = out.split()[0]
349 349
350 self.size = rootfs_size 350 self.size = rootfs_size
@@ -378,12 +378,12 @@ class Wic_PartData(Mic_PartData):
378 378
379 dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ 379 dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
380 (fs, self.size) 380 (fs, self.size)
381 rc, out = exec_cmd(dd_cmd) 381 exec_cmd(dd_cmd)
382 382
383 extra_imagecmd = "-i 8192" 383 extra_imagecmd = "-i 8192"
384 384
385 mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs) 385 mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs)
386 rc, out = exec_native_cmd(mkfs_cmd, native_sysroot) 386 exec_native_cmd(mkfs_cmd, native_sysroot)
387 387
388 self.source_file = fs 388 self.source_file = fs
389 389
@@ -398,13 +398,13 @@ class Wic_PartData(Mic_PartData):
398 398
399 dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ 399 dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
400 (fs, self.size) 400 (fs, self.size)
401 rc, out = exec_cmd(dd_cmd) 401 exec_cmd(dd_cmd)
402 402
403 mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, rootfs) 403 mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, rootfs)
404 rc, out = exec_native_cmd(mkfs_cmd, native_sysroot) 404 exec_native_cmd(mkfs_cmd, native_sysroot)
405 405
406 mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs) 406 mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs)
407 rc, out = exec_native_cmd(mkfs_cmd, native_sysroot) 407 exec_native_cmd(mkfs_cmd, native_sysroot)
408 408
409 self.source_file = fs 409 self.source_file = fs
410 410
@@ -445,13 +445,13 @@ class Wic_PartData(Mic_PartData):
445 445
446 squashfs_cmd = "mksquashfs %s %s -noappend" % \ 446 squashfs_cmd = "mksquashfs %s %s -noappend" % \
447 (tmpdir, fs) 447 (tmpdir, fs)
448 rc, out = exec_native_cmd(squashfs_cmd, native_sysroot) 448 exec_native_cmd(squashfs_cmd, native_sysroot)
449 449
450 os.rmdir(tmpdir) 450 os.rmdir(tmpdir)
451 451
452 # get the rootfs size in the right units for kickstart (Mb) 452 # get the rootfs size in the right units for kickstart (Mb)
453 du_cmd = "du -Lbms %s" % fs 453 du_cmd = "du -Lbms %s" % fs
454 rc, out = exec_cmd(du_cmd) 454 out = exec_cmd(du_cmd)
455 fs_size = out.split()[0] 455 fs_size = out.split()[0]
456 456
457 self.size = fs_size 457 self.size = fs_size
@@ -467,14 +467,14 @@ class Wic_PartData(Mic_PartData):
467 467
468 dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ 468 dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
469 (fs, self.size) 469 (fs, self.size)
470 rc, out = exec_cmd(dd_cmd) 470 exec_cmd(dd_cmd)
471 471
472 import uuid 472 import uuid
473 label_str = "" 473 label_str = ""
474 if self.label: 474 if self.label:
475 label_str = "-L %s" % self.label 475 label_str = "-L %s" % self.label
476 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs) 476 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs)
477 rc, out = exec_native_cmd(mkswap_cmd, native_sysroot) 477 exec_native_cmd(mkswap_cmd, native_sysroot)
478 478
479 self.source_file = fs 479 self.source_file = fs
480 480