diff options
-rw-r--r-- | scripts/lib/wic/imager/direct.py | 15 |
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 | |||
33 | from wic.utils.errors import CreatorError, ImageError | 33 | from wic.utils.errors import CreatorError, ImageError |
34 | from wic.imager.baseimager import BaseImageCreator | 34 | from wic.imager.baseimager import BaseImageCreator |
35 | from wic.plugin import pluginmgr | 35 | from wic.plugin import pluginmgr |
36 | from wic.utils.oe.misc import exec_cmd | ||
36 | 37 | ||
37 | disk_methods = { | 38 | disk_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' |