summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-03-30 14:05:52 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-01 08:14:57 +0100
commitb4d15e071399dbadf2a9334cc5d49f0a406ac160 (patch)
tree78743192d3a5189ee210a86630dc8ecc6132359b /scripts
parent54cd064c669b42d498a5f47a1e4f79d17b3fe3ba (diff)
downloadpoky-b4d15e071399dbadf2a9334cc5d49f0a406ac160.tar.gz
wic: don't silently skip unknown fstypes
Fixed wic code that loops through hard-coded list of known fstypes to find prepare_rootfs_<fstype> or prepare_empty_partition_<fstype> methods and silently skipping unknown fstypes. (From OE-Core rev: ebb8fb5f81f473156c9aa4bf1965e538492a851b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/partition.py32
1 files changed, 13 insertions, 19 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index f0e88fb4e8..28ad3e6473 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -145,13 +145,11 @@ class Partition():
145 self.lineno, self.fstype) 145 self.lineno, self.fstype)
146 if os.path.isfile(rootfs): 146 if os.path.isfile(rootfs):
147 os.remove(rootfs) 147 os.remove(rootfs)
148 for prefix in ("ext", "btrfs", "vfat", "squashfs"): 148
149 if self.fstype.startswith(prefix): 149 prefix = "ext" if self.fstype.startswith("ext") else self.fstype
150 method = getattr(self, 150 method = getattr(self, "prepare_empty_partition_" + prefix)
151 "prepare_empty_partition_" + prefix) 151 method(rootfs, oe_builddir, native_sysroot)
152 method(rootfs, oe_builddir, native_sysroot) 152 self.source_file = rootfs
153 self.source_file = rootfs
154 break
155 return 153 return
156 154
157 plugins = PluginMgr.get_plugins('source') 155 plugins = PluginMgr.get_plugins('source')
@@ -231,19 +229,15 @@ class Partition():
231 '--overhead-factor will be applied') 229 '--overhead-factor will be applied')
232 self.size = int(round(float(rsize_bb))) 230 self.size = int(round(float(rsize_bb)))
233 231
234 for prefix in ("ext", "btrfs", "vfat", "squashfs"): 232 prefix = "ext" if self.fstype.startswith("ext") else self.fstype
235 if self.fstype.startswith(prefix): 233 method = getattr(self, "prepare_rootfs_" + prefix)
236 method = getattr(self, "prepare_rootfs_" + prefix) 234 method(rootfs, oe_builddir, rootfs_dir, native_sysroot, pseudo)
237 method(rootfs, oe_builddir, rootfs_dir, native_sysroot, pseudo) 235 self.source_file = rootfs
238
239 self.source_file = rootfs
240 236
241 # get the rootfs size in the right units for kickstart (kB) 237 # get the rootfs size in the right units for kickstart (kB)
242 du_cmd = "du -Lbks %s" % rootfs 238 du_cmd = "du -Lbks %s" % rootfs
243 out = exec_cmd(du_cmd) 239 out = exec_cmd(du_cmd)
244 self.size = int(out.split()[0]) 240 self.size = int(out.split()[0])
245
246 break
247 241
248 def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir, 242 def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir,
249 native_sysroot, pseudo): 243 native_sysroot, pseudo):