livecd/liveusb will quit decently for arm images
authorJF Ding <Jian-feng.Ding@intel.com>
Thu, 1 Sep 2011 08:21:59 +0000 (17:21 +0900)
committerJF Ding <Jian-feng.Ding@intel.com>
Thu, 1 Sep 2011 08:21:59 +0000 (17:21 +0900)
because livecd/liveusb images need 'syslinux' which is x86 only package,
we will never support livecd/liveusb formats for arm images.

mic/imager/liveusb.py
mic/imager/loop.py
plugins/imager/livecd_plugin.py
plugins/imager/liveusb_plugin.py
plugins/imager/loop_plugin.py
plugins/imager/raw_plugin.py

index 3281afd..c1ff2b7 100644 (file)
@@ -24,7 +24,7 @@ import re
 
 from mic import msger
 from mic.utils import misc, fs_related
-from mic.utils.errors import CreatorError
+from mic.utils.errors import CreatorError, MountError
 from mic.utils.partitionedfs import PartitionedMount
 
 from livecd import LiveCDImageCreator
index be96550..d81c095 100644 (file)
@@ -21,7 +21,7 @@ import os
 import shutil
 
 from mic import kickstart, msger
-from mic.utils.errors import CreatorError
+from mic.utils.errors import CreatorError, MountError
 from mic.utils.fs_related import ExtDiskMount, BtrfsDiskMount, SparseLoopbackDisk
 
 from baseimager import BaseImageCreator
index 3cc11e0..554da78 100644 (file)
@@ -50,6 +50,10 @@ class LiveCDPlugin(ImagerPlugin):
         cfgmgr.setProperty("ksconf", ksconf)
         creatoropts = cfgmgr.create
 
+        if creatoropts['arch'].startswith('arm'):
+            msger.warning('livecd cannot support arm images, Quit')
+            return
+
         # try to find the pkgmgr
         pkgmgr = None
         plgmgr = pluginmgr.PluginMgr()
@@ -73,7 +77,7 @@ class LiveCDPlugin(ImagerPlugin):
             creator.print_outimage_info()
             outimage = creator.outimage
 
-        except CreatorError, e:
+        except errors.CreatorError, e:
             raise errors.CreatorError("failed to create image : %s" % e)
 
         finally:
@@ -102,7 +106,7 @@ class LiveCDPlugin(ImagerPlugin):
         try:
             extloop.mount()
 
-        except MountError, e:
+        except errors.MountError, e:
             extloop.cleanup()
             shutil.rmtree(extmnt, ignore_errors = True)
             shutil.rmtree(os_image_dir, ignore_errors = True)
@@ -156,7 +160,7 @@ class LiveCDPlugin(ImagerPlugin):
         imgloop = fs_related.DiskMount(fs_related.LoopbackDisk(img, 0), imgmnt)
         try:
             imgloop.mount()
-        except MountError, e:
+        except errors.MountError, e:
             imgloop.cleanup()
             raise errors.CreatorError("Failed to loopback mount '%s' : %s" %(img, e))
 
index f72126e..d7a166f 100644 (file)
@@ -53,6 +53,10 @@ class LiveUSBPlugin(ImagerPlugin):
         creatoropts = cfgmgr.create
         cfgmgr.setProperty("ksconf", args[0])
 
+        if creatoropts['arch'].startswith('arm'):
+            msger.warning('liveusb cannot support arm images, Quit')
+            return
+
         # try to find the pkgmgr
         pkgmgr = None
         plgmgr = pluginmgr.PluginMgr()
@@ -73,7 +77,7 @@ class LiveUSBPlugin(ImagerPlugin):
             creator.print_outimage_info()
             outimage = creator.outimage
 
-        except CreatorError, e:
+        except errors.CreatorError, e:
             raise errors.CreatorError("failed to create image : %s" % e)
         finally:
             creator.cleanup()
@@ -101,7 +105,7 @@ class LiveUSBPlugin(ImagerPlugin):
         try:
             extloop.mount()
 
-        except MountError, e:
+        except errors.MountError, e:
             extloop.cleanup()
             shutil.rmtree(extmnt, ignore_errors = True)
             raise errors.CreatorError("Failed to loopback mount '%s' : %s" %(os_image, e))
@@ -158,7 +162,7 @@ class LiveUSBPlugin(ImagerPlugin):
         imgloop.add_partition(imgsize/1024/1024, "/dev/sdb", "/", "vfat", boot=False)
         try:
             imgloop.mount()
-        except MountError, e:
+        except errors.MountError, e:
             imgloop.cleanup()
             raise errors.CreatorError("Failed to loopback mount '%s' : %s" %(img, e))
 
index bf24a91..e8e69a2 100644 (file)
@@ -68,7 +68,7 @@ class LoopPlugin(ImagerPlugin):
             creator.configure(creatoropts["repomd"])
             creator.unmount()
             creator.package(creatoropts["outdir"])
-        except CreatorError, e:
+        except errors.CreatorError, e:
             raise errors.CreatorError("failed to create image : %s" % e)
         finally:
             creator.cleanup()
@@ -89,7 +89,7 @@ class LoopPlugin(ImagerPlugin):
         try:
             extloop.mount()
 
-        except MountError, e:
+        except errors.MountError, e:
             extloop.cleanup()
             shutil.rmtree(extmnt, ignore_errors = True)
             raise errors.CreatorError("Failed to loopback mount '%s' : %s" %(img, e))
index f26ce9e..02b027a 100644 (file)
@@ -76,7 +76,7 @@ class RawPlugin(ImagerPlugin):
             creator.print_outimage_info()
             outimage = creator.outimage
 
-        except CreatorError, e:
+        except errors.CreatorError, e:
             raise errors.CreatorError("failed to create image : %s" % e)
 
         finally:
@@ -162,7 +162,7 @@ class RawPlugin(ImagerPlugin):
         try:
             imgloop.mount()
 
-        except MountError, e:
+        except errors.MountError, e:
             imgloop.cleanup()
             raise errors.CreatorError("Failed to loopback mount '%s' : %s" % (img, e))
 
@@ -184,7 +184,7 @@ class RawPlugin(ImagerPlugin):
         try:
             srcloop.mount()
 
-        except MountError, e:
+        except errors.MountError, e:
             srcloop.cleanup()
             raise errors.CreatorError("Failed to loopback mount '%s' : %s" %
                                (srcimg, e))