summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/imager/direct.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-22 15:45:30 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-27 22:42:49 +0100
commit34766858cd900501af5b43d6fc626439f8708720 (patch)
treed0151027fb3181e2ea9ea2e1b1fd232fa59fb6db /scripts/lib/wic/imager/direct.py
parent597cba650c444ec7dd28386dc54aea7b49e2b918 (diff)
downloadpoky-34766858cd900501af5b43d6fc626439f8708720.tar.gz
wic: Implement image compressing
Implemented compressing result image with specified compressor. Updated reporting code to show compressed image. [YOCTO #7593] (From OE-Core rev: 31791fa7a168e6b6fb030aeb338c8233b4735af1) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/imager/direct.py')
-rw-r--r--scripts/lib/wic/imager/direct.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index f3f20e0745..2ea7e4e04a 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -33,6 +33,7 @@ from wic.utils.partitionedfs import Image
33from wic.utils.errors import CreatorError, ImageError 33from wic.utils.errors import CreatorError, ImageError
34from wic.imager.baseimager import BaseImageCreator 34from wic.imager.baseimager import BaseImageCreator
35from wic.plugin import pluginmgr 35from wic.plugin import pluginmgr
36from wic.utils.oe.misc import exec_cmd
36 37
37disk_methods = { 38disk_methods = {
38 "do_install_disk":None, 39 "do_install_disk":None,
@@ -71,6 +72,7 @@ class DirectImageCreator(BaseImageCreator):
71 self.bootimg_dir = bootimg_dir 72 self.bootimg_dir = bootimg_dir
72 self.kernel_dir = kernel_dir 73 self.kernel_dir = kernel_dir
73 self.native_sysroot = native_sysroot 74 self.native_sysroot = native_sysroot
75 self.compressor = compressor
74 76
75 def __get_part_num(self, num, parts): 77 def __get_part_num(self, num, parts):
76 """calculate the real partition number, accounting for partitions not 78 """calculate the real partition number, accounting for partitions not
@@ -318,6 +320,13 @@ class DirectImageCreator(BaseImageCreator):
318 self.bootimg_dir, 320 self.bootimg_dir,
319 self.kernel_dir, 321 self.kernel_dir,
320 self.native_sysroot) 322 self.native_sysroot)
323 # Compress the image
324 if self.compressor:
325 for disk_name, disk in self.__image.disks.items():
326 full_path = self._full_path(self.__imgdir, disk_name, "direct")
327 msger.debug("Compressing disk %s with %s" % \
328 (disk_name, self.compressor))
329 exec_cmd("%s %s" % (self.compressor, full_path))
321 330
322 def print_outimage_info(self): 331 def print_outimage_info(self):
323 """ 332 """
@@ -328,7 +337,11 @@ class DirectImageCreator(BaseImageCreator):
328 parts = self._get_parts() 337 parts = self._get_parts()
329 338
330 for disk_name, disk in self.__image.disks.items(): 339 for disk_name, disk in self.__image.disks.items():
331 full_path = self._full_path(self.__imgdir, disk_name, "direct") 340 extension = "direct" + {"gzip": ".gz",
341 "bzip2": ".bz2",
342 "xz": ".xz",
343 "": ""}.get(self.compressor)
344 full_path = self._full_path(self.__imgdir, disk_name, extension)
332 msg += ' %s\n\n' % full_path 345 msg += ' %s\n\n' % full_path
333 346
334 msg += 'The following build artifacts were used to create the image(s):\n' 347 msg += 'The following build artifacts were used to create the image(s):\n'