From a8d5ed94582161798e00004fa36d1e2a42942a1d Mon Sep 17 00:00:00 2001 From: Tom Zanussi Date: Fri, 8 Aug 2014 13:28:54 -0500 Subject: wic: Update/rename install-related code The wic code inherited a basic image-creation flow based on installing packages, but wic doesn't actually install anything, so rename parts of the code dealing with installing to something more appropriate. (From OE-Core rev: b4232041534a79236eb8d8ab5c0024a0ef4da649) Signed-off-by: Tom Zanussi Signed-off-by: Richard Purdie --- scripts/lib/mic/imager/direct.py | 50 ++++++++++++------------- scripts/lib/mic/plugins/imager/direct_plugin.py | 2 +- scripts/lib/mic/utils/partitionedfs.py | 16 ++++---- 3 files changed, 34 insertions(+), 34 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py index 91f64d52cf..8d7b6ee804 100644 --- a/scripts/lib/mic/imager/direct.py +++ b/scripts/lib/mic/imager/direct.py @@ -62,7 +62,7 @@ class DirectImageCreator(BaseImageCreator): """ BaseImageCreator.__init__(self, creatoropts) - self.__instimage = None + self.__image = None self.__disks = {} self.__disk_format = "direct" self._disk_names = [] @@ -226,7 +226,7 @@ class DirectImageCreator(BaseImageCreator): """ parts = self._get_parts() - self.__instimage = PartitionedMount() + self.__image = PartitionedMount() for p in parts: # as a convenience, set source to the boot partition source @@ -250,39 +250,39 @@ class DirectImageCreator(BaseImageCreator): self._restore_fstab(fstab) - self.__instimage.add_partition(int(p.size), - p.disk, - p.mountpoint, - p.source_file, - p.fstype, - p.label, - fsopts = p.fsopts, - boot = p.active, - align = p.align, - part_type = p.part_type) + self.__image.add_partition(int(p.size), + p.disk, + p.mountpoint, + p.source_file, + p.fstype, + p.label, + fsopts = p.fsopts, + boot = p.active, + align = p.align, + part_type = p.part_type) - self.__instimage.layout_partitions(self._ptable_format) + self.__image.layout_partitions(self._ptable_format) self.__imgdir = self.workdir - for disk_name, disk in self.__instimage.disks.items(): + for disk_name, disk in self.__image.disks.items(): full_path = self._full_path(self.__imgdir, disk_name, "direct") msger.debug("Adding disk %s as %s with size %s bytes" \ % (disk_name, full_path, disk['min_size'])) disk_obj = fs_related.DiskImage(full_path, disk['min_size']) self.__disks[disk_name] = disk_obj - self.__instimage.add_disk(disk_name, disk_obj) + self.__image.add_disk(disk_name, disk_obj) - self.__instimage.create() + self.__image.create() - def install(self): + def assemble(self): """ - Install fs images into partitions + Assemble partitions into disk image(s) """ - for disk_name, disk in self.__instimage.disks.items(): + for disk_name, disk in self.__image.disks.items(): full_path = self._full_path(self.__imgdir, disk_name, "direct") - msger.debug("Installing disk %s as %s with size %s bytes" \ + msger.debug("Assembling disk %s as %s with size %s bytes" \ % (disk_name, full_path, disk['min_size'])) - self.__instimage.install(full_path) + self.__image.assemble(full_path) def configure(self): """ @@ -294,7 +294,7 @@ class DirectImageCreator(BaseImageCreator): source_plugin = self.get_default_source_plugin() if source_plugin: self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods) - for disk_name, disk in self.__instimage.disks.items(): + for disk_name, disk in self.__image.disks.items(): self._source_methods["do_install_disk"](disk, disk_name, self, self.workdir, self.oe_builddir, @@ -310,7 +310,7 @@ class DirectImageCreator(BaseImageCreator): parts = self._get_parts() - for disk_name, disk in self.__instimage.disks.items(): + for disk_name, disk in self.__image.disks.items(): full_path = self._full_path(self.__imgdir, disk_name, "direct") msg += ' %s\n\n' % full_path @@ -355,9 +355,9 @@ class DirectImageCreator(BaseImageCreator): return (rootdev, root_part_uuid) def _cleanup(self): - if not self.__instimage is None: + if not self.__image is None: try: - self.__instimage.cleanup() + self.__image.cleanup() except MountError, err: msger.warning("%s" % err) diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py index da18b65f54..2cbd5d11fc 100644 --- a/scripts/lib/mic/plugins/imager/direct_plugin.py +++ b/scripts/lib/mic/plugins/imager/direct_plugin.py @@ -92,7 +92,7 @@ class DirectPlugin(ImagerPlugin): try: creator.create() - creator.install() + creator.assemble() creator.configure() creator.print_outimage_info() diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py index 43a38a9b14..2f950a69d4 100644 --- a/scripts/lib/mic/utils/partitionedfs.py +++ b/scripts/lib/mic/utils/partitionedfs.py @@ -309,11 +309,11 @@ class PartitionedMount: except: pass - def __install_partition(self, num, source_file, start, size): + def __write_partition(self, num, source_file, start, size): """ Install source_file contents into a partition. """ - if not source_file: # nothing to install + if not source_file: # nothing to write return # Start is included in the size so need to substract one from the end. @@ -325,7 +325,7 @@ class PartitionedMount: exec_cmd(dd_cmd) - def install(self, image_file): + def assemble(self, image_file): msger.debug("Installing partitions") self.image_file = image_file @@ -337,12 +337,12 @@ class PartitionedMount: # of the first _logical_ partition. This is why the extended # partition should start one sector before the first logical # partition. - self.__install_partition(p['num'], p['source_file'], - p['start'] - 1, - d['offset'] - p['start']) + self.__write_partition(p['num'], p['source_file'], + p['start'] - 1, + d['offset'] - p['start']) - self.__install_partition(p['num'], p['source_file'], - p['start'], p['size']) + self.__write_partition(p['num'], p['source_file'], + p['start'], p['size']) def create(self): for dev in self.disks.keys(): -- cgit v1.2.3