summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-05-28 10:24:18 +0800
committerGui Chen <gui.chen@intel.com>2012-05-28 10:53:07 +0800
commit94078f7b0374f5593bce7eb39988bbefa5a78243 (patch)
tree0a13f8f9c31ef4736526ede748431ebbba71fedd /plugins
parentc2aa469262647f0b00a4cb8ec5b84cbf6778811d (diff)
downloadmic-94078f7b0374f5593bce7eb39988bbefa5a78243.tar.gz
mic-94078f7b0374f5593bce7eb39988bbefa5a78243.tar.bz2
mic-94078f7b0374f5593bce7eb39988bbefa5a78243.zip
pack images together and support compressed file format
--pack-to is enabled for fs, loop, raw, and includes tar, tar.gz, tar.bz2, zip --compress-image is enabled for loop, raw, and includes gzip, bzip2 --pack-to is compatible with --taring-to --compress-image is compatible with --compress-disk-image Signed-off-by: Gui Chen <gui.chen@intel.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/imager/loop_plugin.py18
-rw-r--r--plugins/imager/raw_plugin.py10
2 files changed, 17 insertions, 11 deletions
diff --git a/plugins/imager/loop_plugin.py b/plugins/imager/loop_plugin.py
index f4f480c..de9c431 100644
--- a/plugins/imager/loop_plugin.py
+++ b/plugins/imager/loop_plugin.py
@@ -30,12 +30,12 @@ class LoopPlugin(ImagerPlugin):
name = 'loop'
@classmethod
- @cmdln.option("--taring-to", dest="compress_to", type='string',
- default=None, help="same with '--compress-to'")
- @cmdln.option("--compress-to", dest="compress_to", type='string',
- default=None, help="Specify compress filename for all image "
- "output, compress type decided by file extension, '.zip' for "
- "zip format, '.tar' for tar format, default is tar format")
+ @cmdln.option("--compress-disk-image", dest="compress_image", type='choice',
+ choices=("gz", "bz2"), default=None,
+ help="Same with --compress-image")
+ @cmdln.option("--compress-image", dest="compress_image", type='choice',
+ choices=("gz", "bz2"), default=None,
+ help="Compress all loop images wiht 'gz' or 'bz2'")
def do_create(self, subcmd, opts, *args):
"""${cmd_name}: create loop image
@@ -92,14 +92,14 @@ class LoopPlugin(ImagerPlugin):
if creatoropts['runtime']:
rt_util.runmic_in_runtime(creatoropts['runtime'], creatoropts, ksconf, None)
- creator = LoopImageCreator(creatoropts, pkgmgr, opts.compress_to)
+ creator = LoopImageCreator(creatoropts, pkgmgr, opts.compress_image)
if len(recording_pkgs) > 0:
creator._recording_pkgs = recording_pkgs
if creatoropts['release'] is None:
- if opts.compress_to:
- imagefile = "%s" % os.path.join(creator.destdir, creator.compress_to)
+ if creatoropts['pack_to']:
+ imagefile = "%s" % os.path.join(creator.destdir, creator.pack_to)
else:
imagefile = "%s.img" % os.path.join(creator.destdir, creator.name)
diff --git a/plugins/imager/raw_plugin.py b/plugins/imager/raw_plugin.py
index f0d02bb..6fbb35f 100644
--- a/plugins/imager/raw_plugin.py
+++ b/plugins/imager/raw_plugin.py
@@ -21,7 +21,7 @@ import re
import tempfile
from mic import chroot, msger, rt_util
-from mic.utils import misc, fs_related, errors, runner
+from mic.utils import misc, fs_related, errors, runner, cmdln
from mic.conf import configmgr
from mic.plugin import pluginmgr
from mic.utils.partitionedfs import PartitionedMount
@@ -33,6 +33,12 @@ class RawPlugin(ImagerPlugin):
name = 'raw'
@classmethod
+ @cmdln.option("--compress-disk-image", dest="compress_image", type='choice',
+ choices=("gz", "bz2"), default=None,
+ help="Same with --compress-image")
+ @cmdln.option("--compress-image", dest="compress_image", type='choice',
+ choices=("gz", "bz2"), default = None,
+ help="Compress all raw images before package")
def do_create(self, subcmd, opts, *args):
"""${cmd_name}: create raw image
@@ -83,7 +89,7 @@ class RawPlugin(ImagerPlugin):
if creatoropts['runtime']:
rt_util.runmic_in_runtime(creatoropts['runtime'], creatoropts, ksconf, None)
- creator = raw.RawImageCreator(creatoropts, pkgmgr)
+ creator = raw.RawImageCreator(creatoropts, pkgmgr, opts.compress_image)
if len(recording_pkgs) > 0:
creator._recording_pkgs = recording_pkgs