From 0a6668f6e60b4195ff4163c00fc972bacdb27b4b Mon Sep 17 00:00:00 2001
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Date: Mon, 9 Feb 2015 00:16:24 +0100
Subject: wic: remove useless calls to __write_fstab

__write_fstab() is already iterating over parts. There is now need to
call it fort each parts.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 scripts/lib/wic/imager/direct.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'scripts/lib/wic/imager/direct.py')

diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 38d4e78e62..c605e64238 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -136,7 +136,7 @@ class DirectImageCreator(BaseImageCreator):
             fstab_lines.append(fstab_entry)
 
     def _write_fstab(self, fstab, fstab_lines):
-        fstab = open(fstab, "w")
+        fstab = open(fstab + ".new", "w")
         for line in fstab_lines:
             fstab.write(line)
         fstab.close()
@@ -258,12 +258,9 @@ class DirectImageCreator(BaseImageCreator):
             # self.assemble() calls Image.assemble() which calls
             # __write_partitition() for each partition to dd the fs
             # into the partitions.
-            fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
-
             p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir,
                       self.bootimg_dir, self.kernel_dir, self.native_sysroot)
 
-            self._restore_fstab(fstab)
 
             self.__image.add_partition(int(p.size),
                                        p.disk,
@@ -277,6 +274,9 @@ class DirectImageCreator(BaseImageCreator):
                                        no_table = p.no_table,
                                        part_type = p.part_type)
 
+        fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
+        self._restore_fstab(fstab)
+
         self.__image.layout_partitions(self._ptable_format)
 
         self.__imgdir = self.workdir
-- 
cgit v1.2.3