aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-29 11:19:38 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-02 23:01:44 +0100
commitf7059362053c87f96ce68d1ab850962defb76540 (patch)
tree682f7902d4079648b2933924e0357500900d7cfc
parente663b1857fd2975585003bfa4739f8f84c652708 (diff)
downloadopenembedded-core-contrib-f7059362053c87f96ce68d1ab850962defb76540.tar.gz
wic: Remove __write_partition method
Moved code of __write_partition to 'assemble' method. This way it should be more readable. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py36
1 files changed, 15 insertions, 21 deletions
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index d61087a24d..ca4b1f06c0 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -334,30 +334,24 @@ class Image(object):
except:
pass
- def __write_partition(self, num, source_file, start, size, image_file):
- """
- Install source_file contents into a partition.
- """
- if not source_file: # nothing to write
- return
-
- # Start is included in the size so need to substract one from the end.
- end = start + size - 1
- msger.debug("Installed %s in partition %d, sectors %d-%d, "
- "size %d sectors" % (source_file, num, start, end, size))
-
- dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
- (source_file, image_file, self.sector_size, start, size)
- exec_cmd(dd_cmd)
-
-
def assemble(self, image_file):
msger.debug("Installing partitions")
- for p in self.partitions:
- self.__write_partition(p['num'], p['source_file'],
- p['start'], p['size'], image_file)
- os.rename(p['source_file'], image_file + '.p%d' % p['num'])
+ for part in self.partitions:
+ source = part['source_file']
+ if source:
+ # install source_file contents into a partition
+ cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
+ (source, image_file, self.sector_size,
+ part['start'], part['size'])
+ exec_cmd(cmd)
+
+ msger.debug("Installed %s in partition %d, sectors %d-%d, "
+ "size %d sectors" % \
+ (source, part['num'], part['start'],
+ part['start'] + part['size'] - 1, part['size']))
+
+ os.rename(source, image_file + '.p%d' % part['num'])
def create(self):
for dev in self.disks.keys():