diff options
author | Tom Zanussi <tom.zanussi@linux.intel.com> | 2014-07-31 13:55:24 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-11 10:53:08 +0100 |
commit | 68e6adf2df70c3f83d67dc869b3ce989a6902b80 (patch) | |
tree | a650dc42d1ae3db2bd7cf3219a252306376d34e5 | |
parent | 963604605c0eff8c5b6ca6614b6c5fba8ae4dd15 (diff) | |
download | poky-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>
-rw-r--r-- | scripts/lib/mic/kickstart/custom_commands/partition.py | 44 | ||||
-rw-r--r-- | scripts/lib/mic/plugins/source/bootimg-efi.py | 8 | ||||
-rw-r--r-- | scripts/lib/mic/plugins/source/bootimg-pcbios.py | 10 | ||||
-rw-r--r-- | scripts/lib/mic/utils/fs_related.py | 2 | ||||
-rw-r--r-- | scripts/lib/mic/utils/oe/misc.py | 33 | ||||
-rw-r--r-- | scripts/lib/mic/utils/partitionedfs.py | 2 |
6 files changed, 53 insertions, 46 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 | ||
diff --git a/scripts/lib/mic/plugins/source/bootimg-efi.py b/scripts/lib/mic/plugins/source/bootimg-efi.py index 0dd9152b59..aecda6b0f1 100644 --- a/scripts/lib/mic/plugins/source/bootimg-efi.py +++ b/scripts/lib/mic/plugins/source/bootimg-efi.py | |||
@@ -53,7 +53,7 @@ class BootimgEFIPlugin(SourcePlugin): | |||
53 | exec_cmd(rm_cmd) | 53 | exec_cmd(rm_cmd) |
54 | 54 | ||
55 | install_cmd = "install -d %s/EFI/BOOT" % hdddir | 55 | install_cmd = "install -d %s/EFI/BOOT" % hdddir |
56 | tmp = exec_cmd(install_cmd) | 56 | exec_cmd(install_cmd) |
57 | 57 | ||
58 | splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") | 58 | splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") |
59 | if os.path.exists(splash): | 59 | if os.path.exists(splash): |
@@ -116,7 +116,7 @@ class BootimgEFIPlugin(SourcePlugin): | |||
116 | 116 | ||
117 | install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \ | 117 | install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \ |
118 | (staging_kernel_dir, hdddir) | 118 | (staging_kernel_dir, hdddir) |
119 | tmp = exec_cmd(install_cmd) | 119 | exec_cmd(install_cmd) |
120 | 120 | ||
121 | shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, | 121 | shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, |
122 | "%s/grub.cfg" % cr_workdir) | 122 | "%s/grub.cfg" % cr_workdir) |
@@ -128,7 +128,7 @@ class BootimgEFIPlugin(SourcePlugin): | |||
128 | "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) | 128 | "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) |
129 | 129 | ||
130 | du_cmd = "du -bks %s" % hdddir | 130 | du_cmd = "du -bks %s" % hdddir |
131 | rc, out = exec_cmd(du_cmd) | 131 | out = exec_cmd(du_cmd) |
132 | blocks = int(out.split()[0]) | 132 | blocks = int(out.split()[0]) |
133 | 133 | ||
134 | extra_blocks = part.get_extra_block_count(blocks) | 134 | extra_blocks = part.get_extra_block_count(blocks) |
@@ -160,7 +160,7 @@ class BootimgEFIPlugin(SourcePlugin): | |||
160 | exec_cmd(chmod_cmd) | 160 | exec_cmd(chmod_cmd) |
161 | 161 | ||
162 | du_cmd = "du -Lbms %s" % bootimg | 162 | du_cmd = "du -Lbms %s" % bootimg |
163 | rc, out = exec_cmd(du_cmd) | 163 | out = exec_cmd(du_cmd) |
164 | bootimg_size = out.split()[0] | 164 | bootimg_size = out.split()[0] |
165 | 165 | ||
166 | part.set_size(bootimg_size) | 166 | part.set_size(bootimg_size) |
diff --git a/scripts/lib/mic/plugins/source/bootimg-pcbios.py b/scripts/lib/mic/plugins/source/bootimg-pcbios.py index 1211e5c93b..6488ae9729 100644 --- a/scripts/lib/mic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/mic/plugins/source/bootimg-pcbios.py | |||
@@ -78,7 +78,7 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
78 | exec_cmd(rm_cmd) | 78 | exec_cmd(rm_cmd) |
79 | 79 | ||
80 | install_cmd = "install -d %s" % hdddir | 80 | install_cmd = "install -d %s" % hdddir |
81 | tmp = exec_cmd(install_cmd) | 81 | exec_cmd(install_cmd) |
82 | 82 | ||
83 | splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") | 83 | splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") |
84 | if os.path.exists(splash): | 84 | if os.path.exists(splash): |
@@ -144,14 +144,14 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
144 | 144 | ||
145 | install_cmd = "install -m 0644 %s/bzImage %s/vmlinuz" \ | 145 | install_cmd = "install -m 0644 %s/bzImage %s/vmlinuz" \ |
146 | % (staging_kernel_dir, hdddir) | 146 | % (staging_kernel_dir, hdddir) |
147 | tmp = exec_cmd(install_cmd) | 147 | exec_cmd(install_cmd) |
148 | 148 | ||
149 | install_cmd = "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" \ | 149 | install_cmd = "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" \ |
150 | % (staging_data_dir, hdddir) | 150 | % (staging_data_dir, hdddir) |
151 | tmp = exec_cmd(install_cmd) | 151 | exec_cmd(install_cmd) |
152 | 152 | ||
153 | du_cmd = "du -bks %s" % hdddir | 153 | du_cmd = "du -bks %s" % hdddir |
154 | rc, out = exec_cmd(du_cmd) | 154 | out = exec_cmd(du_cmd) |
155 | blocks = int(out.split()[0]) | 155 | blocks = int(out.split()[0]) |
156 | 156 | ||
157 | extra_blocks = part.get_extra_block_count(blocks) | 157 | extra_blocks = part.get_extra_block_count(blocks) |
@@ -186,7 +186,7 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
186 | exec_cmd(chmod_cmd) | 186 | exec_cmd(chmod_cmd) |
187 | 187 | ||
188 | du_cmd = "du -Lbms %s" % bootimg | 188 | du_cmd = "du -Lbms %s" % bootimg |
189 | rc, out = exec_cmd(du_cmd) | 189 | out = exec_cmd(du_cmd) |
190 | bootimg_size = out.split()[0] | 190 | bootimg_size = out.split()[0] |
191 | 191 | ||
192 | part.set_size(bootimg_size) | 192 | part.set_size(bootimg_size) |
diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/mic/utils/fs_related.py index dd420e88dc..182171ffd3 100644 --- a/scripts/lib/mic/utils/fs_related.py +++ b/scripts/lib/mic/utils/fs_related.py | |||
@@ -306,7 +306,7 @@ class DiskImage(Disk): | |||
306 | # create disk image | 306 | # create disk image |
307 | dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=1" % \ | 307 | dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=1" % \ |
308 | (self.image_file, blocks) | 308 | (self.image_file, blocks) |
309 | rc, out = exec_cmd(dd_cmd) | 309 | exec_cmd(dd_cmd) |
310 | 310 | ||
311 | self.device = self.image_file | 311 | self.device = self.image_file |
312 | 312 | ||
diff --git a/scripts/lib/mic/utils/oe/misc.py b/scripts/lib/mic/utils/oe/misc.py index 16c250aa9f..bed275090d 100644 --- a/scripts/lib/mic/utils/oe/misc.py +++ b/scripts/lib/mic/utils/oe/misc.py | |||
@@ -28,13 +28,13 @@ | |||
28 | from mic import msger | 28 | from mic import msger |
29 | from mic.utils import runner | 29 | from mic.utils import runner |
30 | 30 | ||
31 | def exec_cmd(cmd_and_args, as_shell = False, catch = 3): | 31 | def __exec_cmd(cmd_and_args, as_shell = False, catch = 3): |
32 | """ | 32 | """ |
33 | Execute command, catching stderr, stdout | 33 | Execute command, catching stderr, stdout |
34 | 34 | ||
35 | Need to execute as_shell if the command uses wildcards | 35 | Need to execute as_shell if the command uses wildcards |
36 | """ | 36 | """ |
37 | msger.debug("exec_cmd: %s" % cmd_and_args) | 37 | msger.debug("__exec_cmd: %s" % cmd_and_args) |
38 | args = cmd_and_args.split() | 38 | args = cmd_and_args.split() |
39 | msger.debug(args) | 39 | msger.debug(args) |
40 | 40 | ||
@@ -43,24 +43,31 @@ def exec_cmd(cmd_and_args, as_shell = False, catch = 3): | |||
43 | else: | 43 | else: |
44 | rc, out = runner.runtool(args, catch) | 44 | rc, out = runner.runtool(args, catch) |
45 | out = out.strip() | 45 | out = out.strip() |
46 | msger.debug("exec_cmd: output for %s (rc = %d): %s" % \ | 46 | msger.debug("__exec_cmd: output for %s (rc = %d): %s" % \ |
47 | (cmd_and_args, rc, out)) | 47 | (cmd_and_args, rc, out)) |
48 | |||
49 | return (rc, out) | ||
50 | |||
51 | |||
52 | def exec_cmd(cmd_and_args, as_shell = False, catch = 3): | ||
53 | """ | ||
54 | Execute command, catching stderr, stdout | ||
55 | |||
56 | Exits if rc non-zero | ||
57 | """ | ||
58 | rc, out = __exec_cmd(cmd_and_args, as_shell, catch) | ||
48 | 59 | ||
49 | if rc != 0: | 60 | if rc != 0: |
50 | # We don't throw exception when return code is not 0, because | 61 | msger.error("exec_cmd: %s returned '%s' instead of 0" % (cmd_and_args, rc)) |
51 | # parted always fails to reload part table with loop devices. This | ||
52 | # prevents us from distinguishing real errors based on return | ||
53 | # code. | ||
54 | msger.warning("WARNING: %s returned '%s' instead of 0" % (cmd_and_args, rc)) | ||
55 | 62 | ||
56 | return (rc, out) | 63 | return out |
57 | 64 | ||
58 | 65 | ||
59 | def exec_cmd_quiet(cmd_and_args, as_shell = False): | 66 | def exec_cmd_quiet(cmd_and_args, as_shell = False): |
60 | """ | 67 | """ |
61 | Execute command, catching nothing in the output | 68 | Execute command, catching nothing in the output |
62 | 69 | ||
63 | Need to execute as_shell if the command uses wildcards | 70 | Exits if rc non-zero |
64 | """ | 71 | """ |
65 | return exec_cmd(cmd_and_args, as_shell, 0) | 72 | return exec_cmd(cmd_and_args, as_shell, 0) |
66 | 73 | ||
@@ -82,7 +89,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3): | |||
82 | args = cmd_and_args.split() | 89 | args = cmd_and_args.split() |
83 | msger.debug(args) | 90 | msger.debug(args) |
84 | 91 | ||
85 | rc, out = exec_cmd(native_cmd_and_args, True, catch) | 92 | rc, out = __exec_cmd(native_cmd_and_args, True, catch) |
86 | 93 | ||
87 | if rc == 127: # shell command-not-found | 94 | if rc == 127: # shell command-not-found |
88 | msger.error("A native (host) program required to build the image " | 95 | msger.error("A native (host) program required to build the image " |
@@ -135,7 +142,7 @@ def find_bitbake_env_lines(image_name): | |||
135 | bitbake_env_cmd = "bitbake -e %s" % image_name | 142 | bitbake_env_cmd = "bitbake -e %s" % image_name |
136 | else: | 143 | else: |
137 | bitbake_env_cmd = "bitbake -e" | 144 | bitbake_env_cmd = "bitbake -e" |
138 | rc, bitbake_env_lines = exec_cmd(bitbake_env_cmd) | 145 | rc, bitbake_env_lines = __exec_cmd(bitbake_env_cmd) |
139 | if rc != 0: | 146 | if rc != 0: |
140 | print "Couldn't get '%s' output." % bitbake_env_cmd | 147 | print "Couldn't get '%s' output." % bitbake_env_cmd |
141 | return None | 148 | return None |
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py index 593cf1f317..83ce869860 100644 --- a/scripts/lib/mic/utils/partitionedfs.py +++ b/scripts/lib/mic/utils/partitionedfs.py | |||
@@ -744,7 +744,7 @@ class PartitionedMount(Mount): | |||
744 | 744 | ||
745 | dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \ | 745 | dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \ |
746 | (source_file, self.image_file, self.sector_size, start, size) | 746 | (source_file, self.image_file, self.sector_size, start, size) |
747 | rc, out = exec_cmd(dd_cmd) | 747 | exec_cmd(dd_cmd) |
748 | 748 | ||
749 | 749 | ||
750 | def install(self, image_file): | 750 | def install(self, image_file): |