summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoonKyu Park <sk7.park@samsung.com>2017-01-13 14:07:35 +0900
committerSoonKyu Park <sk7.park@samsung.com>2017-01-13 14:07:35 +0900
commita8826d2766c617c205ef665f07fcce0b045e3d9e (patch)
tree04679f08237e032715956de0287b0bac17c502b1
parentb2feb95961dc004eb95a2d7dfbe330206cd7331e (diff)
parent90497881622188eff027c87c73dd53c6cdff2d6d (diff)
downloadmic-accepted/tizen_tv.tar.gz
mic-accepted/tizen_tv.tar.bz2
mic-accepted/tizen_tv.zip
Change-Id: Icd174a478b4e10c562c764b0ceb657adcf678e54
-rw-r--r--ChangeLog10
-rw-r--r--debian/changelog12
-rw-r--r--doc/RELEASE_NOTES27
-rw-r--r--mic/__init__.py2
-rwxr-xr-xmic/cmd_create.py21
-rw-r--r--mic/imager/baseimager.py25
-rw-r--r--mic/imager/loop.py60
-rwxr-xr-xmic/imager/raw.py3
-rw-r--r--mic/kickstart/custom_commands/partition.py15
-rw-r--r--mic/utils/errors.py4
-rw-r--r--mic/utils/fs_related.py15
-rw-r--r--packaging/mic.changes8
-rw-r--r--packaging/mic.spec2
-rwxr-xr-xtools/mic15
14 files changed, 208 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 614f76e..316d69b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Release 0.27.3 - Mon Dec 19 2016 - Jiankang Fan <jiankang.fan@samsung.com>
+=====================================================================
+ * Support vdfs and squashfs image creation
+ * Show pkgid when install pkg error
+
+Release 0.27.2 - Wed Sep 28 2016 - SoonKyu Park <sk7.park@samsung.com>
+=====================================================================
+ * Add exclude-from-image option to exclude specific images
+ * Add subcommand option parameters(-v, -d, -i)
+
Release 0.27.1 - Wed May 25 2016 - Jianzhong Fang <jz.fang@samsung.com>
=====================================================================
* new distribution support: Ubuntu 16.04, Fedora 23
diff --git a/debian/changelog b/debian/changelog
index 3924533..2e290fc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+mic (0.27.3) unstable; urgency=low
+ * support vdfs and squashfs image creation
+ * Show pkgid when install pkg error
+
+ -- Jiankang Fan <jiankang.fan@samsung.com> Mon, 19 Dec 2016 15:00:00 +0800
+
+mic (0.27.2) unstable; urgency=low
+ * Add exclude-from-image option to exclude specific images
+ * Add subcommand option parameters(-v, -d, -i)
+
+ -- SoonKyu Park <sk7.park@samsung.com> Wed, 28 Sep 2016 15:00:00 +0800
+
mic (0.27.1) unstable; urgency=low
* new distribution support: Ubuntu 16.04, Fedora 23
* add raw image format support
diff --git a/doc/RELEASE_NOTES b/doc/RELEASE_NOTES
index c6e1bcb..c5a3c2b 100644
--- a/doc/RELEASE_NOTES
+++ b/doc/RELEASE_NOTES
@@ -1,3 +1,30 @@
+MIC Image Creator 0.27.3 Release Notes
+======================================
+Released Dec 19 2016
+
+This release note documents the changes included in the new release. And
+the release contains new features, enhancements and bug fixes.
+
+New Features & Enhancements
+--------------------------
+ * Show pkgid when install pkg error
+ * support vdfs and squashfs image creation
+
+Bug Fixes
+---------
+
+MIC Image Creator 0.27.2 Release Notes
+======================================
+Released Sep 28 2016
+
+This release note documents the changes included in the new release. And
+the release contains new features, enhancements and bug fixes.
+
+New Features & Enhancements
+--------------------------
+ * Add exclude-from-image option to exclude specific images
+ * Add subcommand option parameters(-v, -d, -i)
+
MIC Image Creator 0.27.1 Release Notes
======================================
Released May 25 2016
diff --git a/mic/__init__.py b/mic/__init__.py
index 7f0bbb8..9951594 100644
--- a/mic/__init__.py
+++ b/mic/__init__.py
@@ -16,7 +16,7 @@
import os, sys
-__version__ = "0.27.1"
+__version__ = "0.27.3"
cur_path = os.path.dirname(__file__) or '.'
sys.path.insert(0, cur_path + '/3rdparty')
diff --git a/mic/cmd_create.py b/mic/cmd_create.py
index ce574a1..54fdbde 100755
--- a/mic/cmd_create.py
+++ b/mic/cmd_create.py
@@ -54,11 +54,28 @@ def main(parser, args, argv):
% args.logfile)
configmgr.create['logfile'] = logfile_abs_path
configmgr.set_logfile()
-
+
if args.subcommand == "auto":
do_auto(parser, args.ksfile, argv)
return
-
+
+ if args.interactive:
+ msger.enable_interactive()
+ else:
+ msger.disable_interactive()
+
+ if args.verbose:
+ msger.set_loglevel('VERBOSE')
+
+ if args.debug:
+ try:
+ import rpm
+ rpm.setVerbosity(rpm.RPMLOG_NOTICE)
+ except ImportError:
+ pass
+
+ msger.set_loglevel('DEBUG')
+
#check the imager type
createrClass = None
for subcmd, klass in pluginmgr.get_plugins('imager').iteritems():
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py
index 01936a1..c905724 100644
--- a/mic/imager/baseimager.py
+++ b/mic/imager/baseimager.py
@@ -1004,7 +1004,15 @@ class BaseImageCreator(object):
continue
return False
-
+
+ def showErrorInfo(filepath):
+ if os.path.isfile(filepath):
+ msger.info("The error install package info:")
+ for line in open(filepath):
+ msger.info(line)
+ else:
+ msger.info("%s is not found." % filepath)
+
def get_ssl_verify(ssl_verify=None):
if ssl_verify is not None:
return not ssl_verify.lower().strip() == 'no'
@@ -1086,6 +1094,7 @@ class BaseImageCreator(object):
pkg_manager.close()
if checkScriptletError(self._instroot + "/tmp/.postscript/error/", "_error"):
+ showErrorInfo(self._instroot + "/tmp/.preload_install_error")
raise CreatorError('scriptlet errors occurred')
# hook post install
@@ -1209,6 +1218,18 @@ class BaseImageCreator(object):
f.write("%s %s" % (md5sum, os.path.basename(image_name)))
self.outimage.append(image_name+".md5sum")
+ def remove_exclude_image(self):
+ for item in self._instloops[:]:
+ if item['exclude_image']:
+ msger.info("Removing %s in image." % item['name'])
+ imgfile = os.path.join(self._imgdir, item['name'])
+ try:
+ os.remove(imgfile)
+ except OSError as err:
+ if err.errno == errno.ENOENT:
+ pass
+ self._instloops.remove(item)
+
def package(self, destdir = "."):
"""Prepares the created image for final delivery.
@@ -1221,6 +1242,8 @@ class BaseImageCreator(object):
this defaults to the current directory.
"""
+ self.remove_exclude_image()
+
self._stage_final_image()
if not os.path.exists(destdir):
diff --git a/mic/imager/loop.py b/mic/imager/loop.py
index 51d8181..c0620a4 100644
--- a/mic/imager/loop.py
+++ b/mic/imager/loop.py
@@ -28,7 +28,8 @@ from mic.archive import packing, compressing
# The maximum string length supported for LoopImageCreator.fslabel
FSLABEL_MAXLEN = 32
-
+# Support for Read-only file system list
+AFTER_MNT_FS = {"squashfs":".sqsh", "vdfs":".vdfs"}
def save_mountpoints(fpath, loops, arch = None):
"""Save mount points mapping to file
@@ -126,12 +127,18 @@ class LoopImageCreator(BaseImageCreator):
"ext3")
self.__fsopts = kickstart.get_image_fsopts(self.ks,
"defaults,noatime")
+ if self.__fstype in AFTER_MNT_FS.keys():
+ self.__fstype = "ext4"
allloops = []
for part in sorted(kickstart.get_partitions(self.ks),
key=lambda p: p.mountpoint):
+ aft_fstype = None
if part.fstype == "swap":
continue
+ elif part.fstype in AFTER_MNT_FS.keys():
+ aft_fstype = part.fstype
+ part.fstype = "ext4"
label = part.label
mp = part.mountpoint
@@ -153,10 +160,14 @@ class LoopImageCreator(BaseImageCreator):
'name': imgname,
'size': part.size or 4096L * 1024 * 1024,
'fstype': part.fstype or 'ext3',
+ 'aft_fstype': aft_fstype or None,
'extopts': part.extopts or None,
+ 'vdfsopts': part.vdfsopts or None,
+ 'squashfsopts': part.squashfsopts or None,
'loop': None, # to be created in _mount_instroot
'uuid': part.uuid or None,
'kspart' : part,
+ 'exclude_image' : part.exclude_image or None,
})
self._instloops = allloops
@@ -179,7 +190,12 @@ class LoopImageCreator(BaseImageCreator):
if not self._instloops:
return None
- return [lo['name'] for lo in self._instloops]
+ names = []
+ for lo in self._instloops :
+ names.append(lo['name'])
+ for ro in AFTER_MNT_FS.values():
+ names.append(lo['name'].replace('.img',ro))
+ return list(set(names))
def _set_fstype(self, fstype):
self.__fstype = fstype
@@ -329,7 +345,8 @@ class LoopImageCreator(BaseImageCreator):
"extopts": None,
"loop": None,
"uuid": None,
- "kspart": None
+ "kspart": None,
+ "exclude_image" : None
})
self._check_imgdir()
@@ -389,6 +406,43 @@ class LoopImageCreator(BaseImageCreator):
for item in self._instloops:
imgfile = os.path.join(self._imgdir, item['name'])
+
+ if item['aft_fstype'] in AFTER_MNT_FS.keys():
+ mountpoint = misc.mkdtemp()
+ ext4img = os.path.join(self._imgdir, item['name'])
+ runner.show('mount -t ext4 %s %s' % (ext4img, mountpoint))
+ runner.show('ls -al %s' % (mountpoint))
+# item['loop'].mount(None, 'not_create')
+# point_mnt = os.path.join(self._instroot, item['mountpoint'].lstrip('/'))
+
+ fs_suffix = AFTER_MNT_FS[item['aft_fstype']]
+ if item['aft_fstype'] == "squashfs":
+# fs.mksquashfs(mountpoint, self._outdir+"/"+item['label']+fs_suffix)
+ args = "mksquashfs " + mountpoint + " " + self._imgdir+"/"+item['label']+fs_suffix
+ if item['squashfsopts']:
+ squashfsopts=item['squashfsopts'].replace(',', ' ')
+ runner.show("mksquashfs --help")
+ runner.show("%s %s" % (args, squashfsopts))
+ else:
+ runner.show("%s " % args)
+
+ if item['aft_fstype'] == "vdfs":
+ ##FIXME temporary code - replace this with fs.mkvdfs()
+ if item['vdfsopts']:
+ vdfsopts=item['vdfsopts'].replace(',', ' ')
+ else:
+ vdfsopts="-i -z 1024M"
+
+ fullpathmkvdfs = "mkfs.vdfs" #find_binary_path("mkfs.vdfs")
+ runner.show("%s --help" % fullpathmkvdfs)
+# fs.mkvdfs(mountpoint, self._outdir+"/"+item['label']+fs_suffix, vdfsopts)
+ runner.show('%s %s -r %s %s' % (fullpathmkvdfs, vdfsopts, mountpoint, self._imgdir+"/"+item['label']+fs_suffix))
+
+ runner.show('umount %s' % mountpoint)
+# os.unlink(mountpoint)
+ runner.show('mv %s %s' % (self._imgdir+"/"+item['label']+fs_suffix, self._imgdir+"/"+item['label']+".img") )
+ runner.show('ls -al %s' % self._imgdir)
+
if item['fstype'] == "ext4":
runner.show('/sbin/tune2fs -O ^huge_file,extents,uninit_bg %s '
% imgfile)
diff --git a/mic/imager/raw.py b/mic/imager/raw.py
index 08f9683..82e9a16 100755
--- a/mic/imager/raw.py
+++ b/mic/imager/raw.py
@@ -597,3 +597,6 @@ class RawImageCreator(BaseImageCreator):
if self.compress_image:
self.image_files.update({'compress': self.compress_image})
super(RawImageCreator, self).create_manifest()
+
+ def remove_exclude_image(self):
+ pass
diff --git a/mic/kickstart/custom_commands/partition.py b/mic/kickstart/custom_commands/partition.py
index d4c39bf..1d31c11 100644
--- a/mic/kickstart/custom_commands/partition.py
+++ b/mic/kickstart/custom_commands/partition.py
@@ -28,6 +28,9 @@ class Mic_PartData(FC4_PartData):
self.extopts = kwargs.get("extopts", None)
self.part_type = kwargs.get("part_type", None)
self.uuid = kwargs.get("uuid", None)
+ self.exclude_image = kwargs.get("exclude_from_image", False)
+ self.vdfsopts = kwargs.get("vdfsopts", None)
+ self.squashfsopts = kwargs.get("squashfsopts", None)
def _getArgsAsStr(self):
retval = FC4_PartData._getArgsAsStr(self)
@@ -40,6 +43,12 @@ class Mic_PartData(FC4_PartData):
retval += " --part-type=%s" % self.part_type
if self.uuid:
retval += " --uuid=%s" % self.uuid
+ if self.exclude_image:
+ retval += " --exclude-from-image"
+ if self.vdfsopts:
+ retval += " --vdfsoptions=%s" % self.vdfsopts
+ if self.squashfsopts:
+ retval += " --squashfsoptions=%s" % self.squashfsopts
return retval
@@ -58,4 +67,10 @@ class Mic_Partition(FC4_Partition):
op.add_option("--part-type", type="string", action="store", dest="part_type",
default=None)
op.add_option("--uuid", dest="uuid", action="store", type="string")
+ op.add_option("--exclude-from-image", action="store_true", dest="exclude_image",
+ default=False)
+ op.add_option("--vdfsoptions", type="string", action="store", dest="vdfsopts",
+ default=None)
+ op.add_option("--squashfsoptions", type="string", action="store", dest="squashfsopts",
+ default=None)
return op
diff --git a/mic/utils/errors.py b/mic/utils/errors.py
index f64b452..12ddde6 100644
--- a/mic/utils/errors.py
+++ b/mic/utils/errors.py
@@ -72,6 +72,10 @@ class SquashfsError(CreatorError):
""" Error class for Squashfs related """
keyword = 'Squashfs'
+class VdfsError(CreatorError):
+ """ Error class for Vdfs related """
+ keyword = 'vdfs'
+
class BootstrapError(CreatorError):
""" Error class for Bootstrap related """
keyword = 'Bootstrap'
diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py
index a6c2c0b..54f68da 100644
--- a/mic/utils/fs_related.py
+++ b/mic/utils/fs_related.py
@@ -69,6 +69,21 @@ def makedirs(dirname):
if err.errno != errno.EEXIST:
raise
+def mkvdfs(in_img, out_img, fsoptions):
+ """ This function is incomplete. """
+ fullpathmkvdfs = find_binary_path("mkfs.vdfs")
+# args = fullpathmkvdfs + " -i -r "+ in_img + " -z 1024M -s " + out_img
+ args = fullpathmkvdfs + " " + fsoptions + " -r " + in_img + " " + out_img
+ msger.verbose("vdfs args: %s" % args)
+ runner.show("%s --help" % fullpathmkvdfs)
+# if not sys.stdout.isatty():
+# args.append("-no-progress")
+# runner.show("%s --help" % fullpathmkvdfs)
+ ret = runner.show(args)
+ if ret != 0:
+ runner.show ("vdfs error")
+ raise VdfsError("' %s' exited with error (%d)" % (args, ret))
+
def mksquashfs(in_img, out_img):
fullpathmksquashfs = find_binary_path("mksquashfs")
args = [fullpathmksquashfs, in_img, out_img]
diff --git a/packaging/mic.changes b/packaging/mic.changes
index 150074e..ef79851 100644
--- a/packaging/mic.changes
+++ b/packaging/mic.changes
@@ -1,3 +1,11 @@
+* Mon Dec 19 2016 Jiankang Fan <jiankang.fan@samsung.com> - 0.27.3
+ * Show pkgid when install pkg error
+ * support vdfs and squashfs image creation
+
+* Wed Sep 28 2016 SoonKyu Park <sk7.park@samsung.com> - 0.27.2
+ * Add exclude-from-image option to exclude specific images
+ * Add subcommand option parameters(-v, -d, -i)
+
* Wed May 25 2016 Jianzhong Fang <jz.fang@samsung.com> - 0.27.1
* new distribution support: Ubuntu 16.04, Fedora 23
* add raw image format support
diff --git a/packaging/mic.spec b/packaging/mic.spec
index c8e1d52..eb52974 100644
--- a/packaging/mic.spec
+++ b/packaging/mic.spec
@@ -9,7 +9,7 @@
Name: mic
Summary: Image Creator for Linux Distributions
-Version: 0.27.1
+Version: 0.27.3
Release: 0
Group: Development/Tools
License: GPLv2
diff --git a/tools/mic b/tools/mic
index c54cb83..26df153 100755
--- a/tools/mic
+++ b/tools/mic
@@ -123,16 +123,25 @@ def create_parser(parser):
dest='strict_mode', default=False,
help='Abort creation of image, if there are some errors'
' during rpm installation. ')
+
+ parent_parser.add_argument('-d', '--debug', action='store_true',
+ help='debug output')
+ parent_parser.add_argument('-v', '--verbose', action='store_true',
+ help='verbose output')
+ parent_parser.add_argument('-i', '--interactive', action='store_true',
+ dest='interactive', default=True,
+ help='interactive output')
+
parser.set_defaults(alias="cr")
subparsers = parser.add_subparsers(title='Subcommands', dest='subcommand')
auto_parser = subparsers.add_parser('auto', parents=[parent_parser], help='auto detect image type from magic header')
-
- fs_parser = subparsers.add_parser('fs', parents=[parent_parser],
+
+ fs_parser = subparsers.add_parser('fs', parents=[parent_parser],
help='create fs image')
fs_parser.add_argument("--include-src", dest = "include_src",action = "store_true",
default = False, help = "Generate a image with source rpms included")
-
+
loop_parser = subparsers.add_parser('loop', parents=[parent_parser], help='create loop image')
loop_parser.add_argument("--compress-disk-image", dest="compress_image",