Modify the arguments that use cpio to generate image.
authorxiaojuan.mao <xiaojuan.mao@samsung.com>
Mon, 22 May 2017 02:10:44 +0000 (10:10 +0800)
committeradmin <yuhuan.yang@samsung.com>
Wed, 12 Jul 2017 15:39:18 +0000 (23:39 +0800)
Change-Id: Ieb9dc524fedd056d0ff61bd2ec139a44395d1daf

mic/3rdparty/pykickstart/options.py [changed mode: 0644->0755]
mic/imager/baseimager.py
mic/imager/loop.py

old mode 100644 (file)
new mode 100755 (executable)
index 341c5d7..d971d92
@@ -137,11 +137,11 @@ def _check_ksboolean(option, opt, value):
         raise OptionValueError(_("Option %(opt)s: invalid boolean value: %(value)r") % mapping)
 
 def _check_string(option, opt, value):
-    if len(value) > 2 and value.startswith("--"):
-        mapping = {"opt": opt, "value": value}
-        raise OptionValueError(_("Option %(opt)s: invalid string value: %(value)r") % mapping)
-    else:
-        return value
+    #if len(value) > 2 and value.startswith("--"):
+        #mapping = {"opt": opt, "value": value}
+        #raise OptionValueError(_("Option %(opt)s: invalid string value: %(value)r") % mapping)
+   # else:
+    return value
 
 # Creates a new Option class that supports several new attributes:
 # - required:  any option with this attribute must be supplied or an exception
index 9b148f7..c3553c1 100755 (executable)
@@ -1265,7 +1265,7 @@ class BaseImageCreator(object):
                         cpiomountdir = os.path.join(self._instroot, item['mountpoint'].lstrip('/'))
                         os.chdir(cpiomountdir)
                         # find . | cpio --create --'format=newc' | gzip > ../ramdisk.img
-                        runner.show('find . | cpio --create --format=%s | gzip > %s' % (item['cpioopts'], imgfile))
+                        runner.show('find . | cpio --create %s | gzip > %s' % (item['cpioopts'], imgfile))
                         shutil.rmtree(cpiomountdir, ignore_errors=True)
                         fs.makedirs(cpiomountdir)
                         os.chdir(oldoutdir)
index d976b88..cca8080 100755 (executable)
@@ -446,9 +446,10 @@ class LoopImageCreator(BaseImageCreator):
                 runner.show('ls -al %s' % self._imgdir)
 
             if item['fstype'] == "ext4":
-                runner.show('/sbin/tune2fs -O ^huge_file,extents,uninit_bg %s '
+                if not item['cpioopts']:
+                    runner.show('/sbin/tune2fs -O ^huge_file,extents,uninit_bg %s '
                             % imgfile)
-                runner.quiet(["/sbin/e2fsck", "-f", "-y", imgfile])
+                    runner.quiet(["/sbin/e2fsck", "-f", "-y", imgfile])
             self.image_files.setdefault('partitions', {}).update(
                     {item['mountpoint']: item['label']})
             if self.compress_image: