All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/35] wic: Make exec_cmd() error out instead of warn
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 02/35] wic: Remove unused custom commands Tom Zanussi
                   ` (33 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

The reason exec_cmd() warns but doesn't error out (broken parted)
doesn't really make sense, since the parted invocations don't even use
exec_cmd().  It really should just fail since by not doing so it's
actually enabling invalid images in some cases.

Also, since the return code is now always zero, there's no point in
having a return code, so remove it.  This represents a change in the
API, so we also need to update all callers.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 .../lib/mic/kickstart/custom_commands/partition.py | 44 +++++++++++-----------
 scripts/lib/mic/plugins/source/bootimg-efi.py      |  8 ++--
 scripts/lib/mic/plugins/source/bootimg-pcbios.py   | 10 ++---
 scripts/lib/mic/utils/fs_related.py                |  2 +-
 scripts/lib/mic/utils/oe/misc.py                   | 33 +++++++++-------
 scripts/lib/mic/utils/partitionedfs.py             |  2 +-
 6 files changed, 53 insertions(+), 46 deletions(-)

diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
index 3b652b3..101b90e 100644
--- a/scripts/lib/mic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
@@ -161,7 +161,7 @@ class Wic_PartData(Mic_PartData):
         """
         rootfs = oe_builddir
         du_cmd = "du -Lbms %s" % rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         rootfs_size = out.split()[0]
 
         self.size = rootfs_size
@@ -209,7 +209,7 @@ class Wic_PartData(Mic_PartData):
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
 
         du_cmd = "du -ks %s" % image_rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
 
         extra_blocks = self.get_extra_block_count(actual_rootfs_size)
@@ -224,18 +224,18 @@ class Wic_PartData(Mic_PartData):
 
         dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \
             (rootfs, rootfs_size)
-        rc, out = exec_cmd(dd_cmd)
+        exec_cmd(dd_cmd)
 
         extra_imagecmd = "-i 8192"
 
         mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
             (self.fstype, extra_imagecmd, rootfs, image_rootfs)
-        rc, out = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
+        exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
 
 
         # get the rootfs size in the right units for kickstart (Mb)
         du_cmd = "du -Lbms %s" % rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         rootfs_size = out.split()[0]
 
         self.size = rootfs_size
@@ -254,7 +254,7 @@ class Wic_PartData(Mic_PartData):
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
         du_cmd = "du -ks %s" % image_rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
 
         extra_blocks = self.get_extra_block_count(actual_rootfs_size)
@@ -269,15 +269,15 @@ class Wic_PartData(Mic_PartData):
 
         dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \
             (rootfs, rootfs_size)
-        rc, out = exec_cmd(dd_cmd)
+        exec_cmd(dd_cmd)
 
         mkfs_cmd = "mkfs.%s -b %d -r %s %s" % \
             (self.fstype, rootfs_size * 1024, image_rootfs, rootfs)
-        rc, out = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
+        exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
 
         # get the rootfs size in the right units for kickstart (Mb)
         du_cmd = "du -Lbms %s" % rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         rootfs_size = out.split()[0]
 
         self.size = rootfs_size
@@ -292,7 +292,7 @@ class Wic_PartData(Mic_PartData):
         rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype)
 
         du_cmd = "du -bks %s" % image_rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
 
         extra_blocks = self.get_extra_block_count(blocks)
@@ -324,7 +324,7 @@ class Wic_PartData(Mic_PartData):
 
         # get the rootfs size in the right units for kickstart (Mb)
         du_cmd = "du -Lbms %s" % rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         rootfs_size = out.split()[0]
 
         self.set_size(rootfs_size)
@@ -340,11 +340,11 @@ class Wic_PartData(Mic_PartData):
 
         squashfs_cmd = "mksquashfs %s %s -noappend" % \
                        (image_rootfs, rootfs)
-        rc, out = exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
+        exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
 
         # get the rootfs size in the right units for kickstart (Mb)
         du_cmd = "du -Lbms %s" % rootfs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         rootfs_size = out.split()[0]
 
         self.size = rootfs_size
@@ -378,12 +378,12 @@ class Wic_PartData(Mic_PartData):
 
         dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
             (fs, self.size)
-        rc, out = exec_cmd(dd_cmd)
+        exec_cmd(dd_cmd)
 
         extra_imagecmd = "-i 8192"
 
         mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs)
-        rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
+        exec_native_cmd(mkfs_cmd, native_sysroot)
 
         self.source_file = fs
 
@@ -398,13 +398,13 @@ class Wic_PartData(Mic_PartData):
 
         dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
             (fs, self.size)
-        rc, out = exec_cmd(dd_cmd)
+        exec_cmd(dd_cmd)
 
         mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, rootfs)
-        rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
+        exec_native_cmd(mkfs_cmd, native_sysroot)
 
         mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs)
-        rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
+        exec_native_cmd(mkfs_cmd, native_sysroot)
 
         self.source_file = fs
 
@@ -445,13 +445,13 @@ class Wic_PartData(Mic_PartData):
 
         squashfs_cmd = "mksquashfs %s %s -noappend" % \
                        (tmpdir, fs)
-        rc, out = exec_native_cmd(squashfs_cmd, native_sysroot)
+        exec_native_cmd(squashfs_cmd, native_sysroot)
 
         os.rmdir(tmpdir)
 
         # get the rootfs size in the right units for kickstart (Mb)
         du_cmd = "du -Lbms %s" % fs
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         fs_size = out.split()[0]
 
         self.size = fs_size
@@ -467,14 +467,14 @@ class Wic_PartData(Mic_PartData):
 
         dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
             (fs, self.size)
-        rc, out = exec_cmd(dd_cmd)
+        exec_cmd(dd_cmd)
 
         import uuid
         label_str = ""
         if self.label:
             label_str = "-L %s" % self.label
         mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs)
-        rc, out = exec_native_cmd(mkswap_cmd, native_sysroot)
+        exec_native_cmd(mkswap_cmd, native_sysroot)
 
         self.source_file = fs
 
diff --git a/scripts/lib/mic/plugins/source/bootimg-efi.py b/scripts/lib/mic/plugins/source/bootimg-efi.py
index 0dd9152..aecda6b 100644
--- a/scripts/lib/mic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/mic/plugins/source/bootimg-efi.py
@@ -53,7 +53,7 @@ class BootimgEFIPlugin(SourcePlugin):
         exec_cmd(rm_cmd)
 
         install_cmd = "install -d %s/EFI/BOOT" % hdddir
-        tmp = exec_cmd(install_cmd)
+        exec_cmd(install_cmd)
 
         splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
         if os.path.exists(splash):
@@ -116,7 +116,7 @@ class BootimgEFIPlugin(SourcePlugin):
 
         install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \
             (staging_kernel_dir, hdddir)
-        tmp = exec_cmd(install_cmd)
+        exec_cmd(install_cmd)
 
         shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
                         "%s/grub.cfg" % cr_workdir)
@@ -128,7 +128,7 @@ class BootimgEFIPlugin(SourcePlugin):
                     "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir)
 
         du_cmd = "du -bks %s" % hdddir
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
 
         extra_blocks = part.get_extra_block_count(blocks)
@@ -160,7 +160,7 @@ class BootimgEFIPlugin(SourcePlugin):
         exec_cmd(chmod_cmd)
 
         du_cmd = "du -Lbms %s" % bootimg
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         bootimg_size = out.split()[0]
 
         part.set_size(bootimg_size)
diff --git a/scripts/lib/mic/plugins/source/bootimg-pcbios.py b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
index 1211e5c..6488ae9 100644
--- a/scripts/lib/mic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
@@ -78,7 +78,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         exec_cmd(rm_cmd)
 
         install_cmd = "install -d %s" % hdddir
-        tmp = exec_cmd(install_cmd)
+        exec_cmd(install_cmd)
 
         splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg")
         if os.path.exists(splash):
@@ -144,14 +144,14 @@ class BootimgPcbiosPlugin(SourcePlugin):
 
         install_cmd = "install -m 0644 %s/bzImage %s/vmlinuz" \
             % (staging_kernel_dir, hdddir)
-        tmp = exec_cmd(install_cmd)
+        exec_cmd(install_cmd)
 
         install_cmd = "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" \
             % (staging_data_dir, hdddir)
-        tmp = exec_cmd(install_cmd)
+        exec_cmd(install_cmd)
 
         du_cmd = "du -bks %s" % hdddir
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
 
         extra_blocks = part.get_extra_block_count(blocks)
@@ -186,7 +186,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         exec_cmd(chmod_cmd)
 
         du_cmd = "du -Lbms %s" % bootimg
-        rc, out = exec_cmd(du_cmd)
+        out = exec_cmd(du_cmd)
         bootimg_size = out.split()[0]
 
         part.set_size(bootimg_size)
diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/mic/utils/fs_related.py
index dd420e8..182171f 100644
--- a/scripts/lib/mic/utils/fs_related.py
+++ b/scripts/lib/mic/utils/fs_related.py
@@ -306,7 +306,7 @@ class DiskImage(Disk):
         # create disk image
         dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=1" % \
             (self.image_file, blocks)
-        rc, out = exec_cmd(dd_cmd)
+        exec_cmd(dd_cmd)
 
         self.device = self.image_file
 
diff --git a/scripts/lib/mic/utils/oe/misc.py b/scripts/lib/mic/utils/oe/misc.py
index 16c250a..bed2750 100644
--- a/scripts/lib/mic/utils/oe/misc.py
+++ b/scripts/lib/mic/utils/oe/misc.py
@@ -28,13 +28,13 @@
 from mic import msger
 from mic.utils import runner
 
-def exec_cmd(cmd_and_args, as_shell = False, catch = 3):
+def __exec_cmd(cmd_and_args, as_shell = False, catch = 3):
     """
     Execute command, catching stderr, stdout
 
     Need to execute as_shell if the command uses wildcards
     """
-    msger.debug("exec_cmd: %s" % cmd_and_args)
+    msger.debug("__exec_cmd: %s" % cmd_and_args)
     args = cmd_and_args.split()
     msger.debug(args)
 
@@ -43,24 +43,31 @@ def exec_cmd(cmd_and_args, as_shell = False, catch = 3):
     else:
         rc, out = runner.runtool(args, catch)
     out = out.strip()
-    msger.debug("exec_cmd: output for %s (rc = %d): %s" % \
-                    (cmd_and_args, rc, out))
+    msger.debug("__exec_cmd: output for %s (rc = %d): %s" % \
+                (cmd_and_args, rc, out))
+
+    return (rc, out)
+
+
+def exec_cmd(cmd_and_args, as_shell = False, catch = 3):
+    """
+    Execute command, catching stderr, stdout
+
+    Exits if rc non-zero
+    """
+    rc, out = __exec_cmd(cmd_and_args, as_shell, catch)
 
     if rc != 0:
-        # We don't throw exception when return code is not 0, because
-        # parted always fails to reload part table with loop devices. This
-        # prevents us from distinguishing real errors based on return
-        # code.
-        msger.warning("WARNING: %s returned '%s' instead of 0" % (cmd_and_args, rc))
+        msger.error("exec_cmd: %s returned '%s' instead of 0" % (cmd_and_args, rc))
 
-    return (rc, out)
+    return out
 
 
 def exec_cmd_quiet(cmd_and_args, as_shell = False):
     """
     Execute command, catching nothing in the output
 
-    Need to execute as_shell if the command uses wildcards
+    Exits if rc non-zero
     """
     return exec_cmd(cmd_and_args, as_shell, 0)
 
@@ -82,7 +89,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3):
     args = cmd_and_args.split()
     msger.debug(args)
 
-    rc, out = exec_cmd(native_cmd_and_args, True, catch)
+    rc, out = __exec_cmd(native_cmd_and_args, True, catch)
 
     if rc == 127: # shell command-not-found
         msger.error("A native (host) program required to build the image "
@@ -135,7 +142,7 @@ def find_bitbake_env_lines(image_name):
         bitbake_env_cmd = "bitbake -e %s" % image_name
     else:
         bitbake_env_cmd = "bitbake -e"
-    rc, bitbake_env_lines = exec_cmd(bitbake_env_cmd)
+    rc, bitbake_env_lines = __exec_cmd(bitbake_env_cmd)
     if rc != 0:
         print "Couldn't get '%s' output." % bitbake_env_cmd
         return None
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index 593cf1f..83ce869 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -744,7 +744,7 @@ class PartitionedMount(Mount):
 
         dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
             (source_file, self.image_file, self.sector_size, start, size)
-        rc, out = exec_cmd(dd_cmd)
+        exec_cmd(dd_cmd)
 
 
     def install(self, image_file):
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 02/35] wic: Remove unused custom commands
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
  2014-08-08 22:05 ` [PATCH 01/35] wic: Make exec_cmd() error out instead of warn Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 03/35] wic: Remove packaging, config commands Tom Zanussi
                   ` (32 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

installer, repo, desktop-related stuff

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/kickstart/__init__.py              |   6 +-
 .../lib/mic/kickstart/custom_commands/__init__.py  |   7 --
 .../lib/mic/kickstart/custom_commands/desktop.py   |  95 ---------------
 .../mic/kickstart/custom_commands/installerfw.py   |  63 ----------
 .../lib/mic/kickstart/custom_commands/micrepo.py   | 127 ---------------------
 5 files changed, 1 insertion(+), 297 deletions(-)
 delete mode 100644 scripts/lib/mic/kickstart/custom_commands/desktop.py
 delete mode 100644 scripts/lib/mic/kickstart/custom_commands/installerfw.py
 delete mode 100644 scripts/lib/mic/kickstart/custom_commands/micrepo.py

diff --git a/scripts/lib/mic/kickstart/__init__.py b/scripts/lib/mic/kickstart/__init__.py
index 72f3ca6..11cdf63 100644
--- a/scripts/lib/mic/kickstart/__init__.py
+++ b/scripts/lib/mic/kickstart/__init__.py
@@ -32,7 +32,7 @@ from pykickstart.handlers.control import dataMap
 
 from mic import msger
 from mic.utils import errors, misc, runner, fs_related as fs
-from custom_commands import desktop, micrepo, wicboot, partition, installerfw
+from custom_commands import wicboot, partition
 
 
 AUTH_URL_PTN = r"(?P<scheme>.*)://(?P<username>.*)(:?P<password>.*)?@(?P<url>.*)"
@@ -96,13 +96,9 @@ def read_kickstart(path):
     #ks = ksparser.KickstartParser(version)
 
     using_version = ksversion.DEVEL
-    commandMap[using_version]["desktop"] = desktop.Mic_Desktop
-    commandMap[using_version]["repo"] = micrepo.Mic_Repo
     commandMap[using_version]["bootloader"] = wicboot.Wic_Bootloader
     commandMap[using_version]["part"] = partition.Wic_Partition
     commandMap[using_version]["partition"] = partition.Wic_Partition
-    commandMap[using_version]["installerfw"] = installerfw.Mic_installerfw
-    dataMap[using_version]["RepoData"] = micrepo.Mic_RepoData
     dataMap[using_version]["PartData"] = partition.Wic_PartData
     superclass = ksversion.returnClassForVersion(version=using_version)
 
diff --git a/scripts/lib/mic/kickstart/custom_commands/__init__.py b/scripts/lib/mic/kickstart/custom_commands/__init__.py
index 6aed0ff..f84c6d9 100644
--- a/scripts/lib/mic/kickstart/custom_commands/__init__.py
+++ b/scripts/lib/mic/kickstart/custom_commands/__init__.py
@@ -1,17 +1,10 @@
-from desktop import Mic_Desktop
-from micrepo import Mic_Repo, Mic_RepoData
 from micpartition import Mic_Partition
 from micpartition import Mic_PartData
-from installerfw import Mic_installerfw
 from partition import Wic_Partition
 
 __all__ = (
-    "Mic_Desktop",
-    "Mic_Repo",
-    "Mic_RepoData",
     "Mic_Partition",
     "Mic_PartData",
-    "Mic_installerfw",
     "Wic_Partition",
     "Wic_PartData",
 )
diff --git a/scripts/lib/mic/kickstart/custom_commands/desktop.py b/scripts/lib/mic/kickstart/custom_commands/desktop.py
deleted file mode 100644
index c8bd647..0000000
--- a/scripts/lib/mic/kickstart/custom_commands/desktop.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2008, 2009, 2010 Intel, Inc.
-#
-# Yi Yang <yi.y.yang@intel.com>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from pykickstart.base import *
-from pykickstart.errors import *
-from pykickstart.options import *
-
-class Mic_Desktop(KickstartCommand):
-    def __init__(self, writePriority=0,
-                       defaultdesktop=None,
-                       defaultdm=None,
-                       autologinuser=None,
-                       session=None):
-
-        KickstartCommand.__init__(self, writePriority)
-
-        self.__new_version = False
-        self.op = self._getParser()
-
-        self.defaultdesktop = defaultdesktop
-        self.autologinuser = autologinuser
-        self.defaultdm = defaultdm
-        self.session = session
-
-    def __str__(self):
-        retval = ""
-
-        if self.defaultdesktop != None:
-            retval += " --defaultdesktop=%s" % self.defaultdesktop
-        if self.session != None:
-            retval += " --session=\"%s\"" % self.session
-        if self.autologinuser != None:
-            retval += " --autologinuser=%s" % self.autologinuser
-        if self.defaultdm != None:
-            retval += " --defaultdm=%s" % self.defaultdm
-
-        if retval != "":
-            retval = "# Default Desktop Settings\ndesktop %s\n" % retval
-
-        return retval
-
-    def _getParser(self):
-        try:
-            op = KSOptionParser(lineno=self.lineno)
-        except TypeError:
-            # the latest version has not lineno argument
-            op = KSOptionParser()
-            self.__new_version = True
-
-        op.add_option("--defaultdesktop", dest="defaultdesktop",
-                                          action="store",
-                                          type="string",
-                                          nargs=1)
-        op.add_option("--autologinuser", dest="autologinuser",
-                                         action="store",
-                                         type="string",
-                                         nargs=1)
-        op.add_option("--defaultdm", dest="defaultdm",
-                                     action="store",
-                                     type="string",
-                                     nargs=1)
-        op.add_option("--session", dest="session",
-                                   action="store",
-                                   type="string",
-                                   nargs=1)
-        return op
-
-    def parse(self, args):
-        if self.__new_version:
-            (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
-        else:
-            (opts, extra) = self.op.parse_args(args=args)
-
-        if extra:
-            m = _("Unexpected arguments to %(command)s command: %(options)s") \
-                  % {"command": "desktop", "options": extra}
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg=m)
-
-        self._setToSelf(self.op, opts)
diff --git a/scripts/lib/mic/kickstart/custom_commands/installerfw.py b/scripts/lib/mic/kickstart/custom_commands/installerfw.py
deleted file mode 100644
index 2466f1d..0000000
--- a/scripts/lib/mic/kickstart/custom_commands/installerfw.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2013 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from pykickstart.base import *
-from pykickstart.options import *
-
-class Mic_installerfw(KickstartCommand):
-    """ This class implements the "installerfw" KS option. The argument
-    of the option is a comman-separated list of MIC features which have to be
-    disabled and instead, will be done in the installer. For example,
-    "installerfw=extlinux" disables all the MIC code which installs extlinux to
-    the target images, and instead, the extlinux or whatever boot-loader will
-    be installed by the installer instead.
-
-    The installer is a tool which is external to MIC, it comes from the
-    installation repositories and can be executed by MIC in order to perform
-    various configuration actions. The main point here is to make sure MIC has
-    no hard-wired knoledge about the target OS configuration. """
-
-    removedKeywords = KickstartCommand.removedKeywords
-    removedAttrs = KickstartCommand.removedAttrs
-
-    def __init__(self, *args, **kwargs):
-        KickstartCommand.__init__(self, *args, **kwargs)
-        self.op = self._getParser()
-        self.features = kwargs.get("installerfw", None)
-
-    def __str__(self):
-        retval = KickstartCommand.__str__(self)
-
-        if self.features:
-            retval += "# Enable installer framework features\ninstallerfw\n"
-
-        return retval
-
-    def _getParser(self):
-        op = KSOptionParser()
-        return op
-
-    def parse(self, args):
-        (_, extra) = self.op.parse_args(args=args, lineno=self.lineno)
-
-        if len(extra) != 1:
-            msg = "Kickstart command \"installerfw\" requires one " \
-                  "argumet - a list of legacy features to disable"
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg = msg)
-
-        self.features = extra[0].split(",")
-        return self
diff --git a/scripts/lib/mic/kickstart/custom_commands/micrepo.py b/scripts/lib/mic/kickstart/custom_commands/micrepo.py
deleted file mode 100644
index b31576e..0000000
--- a/scripts/lib/mic/kickstart/custom_commands/micrepo.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2008, 2009, 2010 Intel, Inc.
-#
-# Yi Yang <yi.y.yang@intel.com>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from pykickstart.base import *
-from pykickstart.errors import *
-from pykickstart.options import *
-from pykickstart.commands.repo import *
-
-class Mic_RepoData(F8_RepoData):
-
-    def __init__(self, baseurl="", mirrorlist=None, name="", priority=None,
-                 includepkgs=(), excludepkgs=(), save=False, proxy=None,
-                 proxy_username=None, proxy_password=None, debuginfo=False,
-                 source=False, gpgkey=None, disable=False, ssl_verify="yes",
-                 nocache=False):
-        kw = {}
-        # F8_RepoData keywords
-        if includepkgs:
-            kw['includepkgs'] = includepkgs
-        if excludepkgs:
-            kw['excludepkgs'] = excludepkgs
-
-        #FC6_RepoData keywords
-        if baseurl:
-            kw['baseurl'] = baseurl
-        if mirrorlist:
-            kw['mirrorlist'] = mirrorlist
-        if name:
-            kw['name'] = name
-
-        F8_RepoData.__init__(self, **kw)
-        self.save = save
-        self.proxy = proxy
-        self.proxy_username = proxy_username
-        self.proxy_password = proxy_password
-        self.debuginfo = debuginfo
-        self.disable = disable
-        self.source = source
-        self.gpgkey = gpgkey
-        self.ssl_verify = ssl_verify.lower()
-        self.priority = priority
-        self.nocache = nocache
-
-    def _getArgsAsStr(self):
-        retval = F8_RepoData._getArgsAsStr(self)
-
-        if self.save:
-            retval += " --save"
-        if self.proxy:
-            retval += " --proxy=%s" % self.proxy
-        if self.proxy_username:
-            retval += " --proxyuser=%s" % self.proxy_username
-        if self.proxy_password:
-            retval += " --proxypasswd=%s" % self.proxy_password
-        if self.debuginfo:
-            retval += " --debuginfo"
-        if self.source:
-            retval += " --source"
-        if self.gpgkey:
-            retval += " --gpgkey=%s" % self.gpgkey
-        if self.disable:
-            retval += " --disable"
-        if self.ssl_verify:
-            retval += " --ssl_verify=%s" % self.ssl_verify
-        if self.priority:
-            retval += " --priority=%s" % self.priority
-        if self.nocache:
-            retval += " --nocache"
-
-        return retval
-
-class Mic_Repo(F8_Repo):
-    def __init__(self, writePriority=0, repoList=None):
-        F8_Repo.__init__(self, writePriority, repoList)
-
-    def __str__(self):
-        retval = ""
-        for repo in self.repoList:
-            retval += repo.__str__()
-
-        return retval
-
-    def _getParser(self):
-        def list_cb (option, opt_str, value, parser):
-            for d in value.split(','):
-                parser.values.ensure_value(option.dest, []).append(d)
-
-        op = F8_Repo._getParser(self)
-        op.add_option("--save", action="store_true", dest="save",
-                      default=False)
-        op.add_option("--proxy", type="string", action="store", dest="proxy",
-                      default=None, nargs=1)
-        op.add_option("--proxyuser", type="string", action="store",
-                      dest="proxy_username", default=None, nargs=1)
-        op.add_option("--proxypasswd", type="string", action="store",
-                      dest="proxy_password", default=None, nargs=1)
-        op.add_option("--debuginfo", action="store_true", dest="debuginfo",
-                      default=False)
-        op.add_option("--source", action="store_true", dest="source",
-                      default=False)
-        op.add_option("--disable", action="store_true", dest="disable",
-                      default=False)
-        op.add_option("--gpgkey", type="string", action="store", dest="gpgkey",
-                      default=None, nargs=1)
-        op.add_option("--ssl_verify", type="string", action="store",
-                      dest="ssl_verify", default="yes")
-        op.add_option("--priority", type="int", action="store", dest="priority",
-                      default=None)
-        op.add_option("--nocache", action="store_true", dest="nocache",
-                      default=False)
-        return op
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 03/35] wic: Remove packaging, config commands
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
  2014-08-08 22:05 ` [PATCH 01/35] wic: Make exec_cmd() error out instead of warn Tom Zanussi
  2014-08-08 22:05 ` [PATCH 02/35] wic: Remove unused custom commands Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 04/35] wic: Remove mic bootstrap Tom Zanussi
                   ` (31 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

Remove commands related to repos, packaging, configuration

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/kickstart/__init__.py | 763 ----------------------------------
 1 file changed, 763 deletions(-)

diff --git a/scripts/lib/mic/kickstart/__init__.py b/scripts/lib/mic/kickstart/__init__.py
index 11cdf63..590bf47 100644
--- a/scripts/lib/mic/kickstart/__init__.py
+++ b/scripts/lib/mic/kickstart/__init__.py
@@ -34,54 +34,6 @@ from mic import msger
 from mic.utils import errors, misc, runner, fs_related as fs
 from custom_commands import wicboot, partition
 
-
-AUTH_URL_PTN = r"(?P<scheme>.*)://(?P<username>.*)(:?P<password>.*)?@(?P<url>.*)"
-
-
-class PrepackageSection(kssections.Section):
-    sectionOpen = "%prepackages"
-
-    def handleLine(self, line):
-        if not self.handler:
-            return
-
-        (h, s, t) = line.partition('#')
-        line = h.rstrip()
-
-        self.handler.prepackages.add([line])
-
-    def handleHeader(self, lineno, args):
-        kssections.Section.handleHeader(self, lineno, args)
-
-class AttachmentSection(kssections.Section):
-    sectionOpen = "%attachment"
-
-    def handleLine(self, line):
-        if not self.handler:
-            return
-
-        (h, s, t) = line.partition('#')
-        line = h.rstrip()
-
-        self.handler.attachment.add([line])
-
-    def handleHeader(self, lineno, args):
-        kssections.Section.handleHeader(self, lineno, args)
-
-def apply_wrapper(func):
-    def wrapper(*kargs, **kwargs):
-        try:
-            func(*kargs, **kwargs)
-        except (OSError, IOError, errors.KsError), err:
-            cfgcls = kargs[0].__class__.__name__
-            if msger.ask("Failed to apply %s, skip and continue?" % cfgcls):
-                msger.warning("%s" % err)
-                pass
-            else:
-                # just throw out the exception
-                raise
-    return wrapper
-
 def read_kickstart(path):
     """Parse a kickstart file and return a KickstartParser instance.
 
@@ -105,12 +57,8 @@ def read_kickstart(path):
     class KSHandlers(superclass):
         def __init__(self):
             superclass.__init__(self, mapping=commandMap[using_version])
-            self.prepackages = ksparser.Packages()
-            self.attachment = ksparser.Packages()
 
     ks = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=False)
-    ks.registerSection(PrepackageSection(ks.handler))
-    ks.registerSection(AttachmentSection(ks.handler))
 
     try:
         ks.readKickstart(path)
@@ -123,526 +71,6 @@ def read_kickstart(path):
 
     return ks
 
-class KickstartConfig(object):
-    """A base class for applying kickstart configurations to a system."""
-    def __init__(self, instroot):
-        self.instroot = instroot
-
-    def path(self, subpath):
-        return self.instroot + subpath
-
-    def _check_sysconfig(self):
-        if not os.path.exists(self.path("/etc/sysconfig")):
-            fs.makedirs(self.path("/etc/sysconfig"))
-
-    def chroot(self):
-        os.chroot(self.instroot)
-        os.chdir("/")
-
-    def call(self, args):
-        if not os.path.exists("%s/%s" %(self.instroot, args[0])):
-            raise errors.KsError("Can't find %s in chroot" % args[0])
-        subprocess.call(args, preexec_fn = self.chroot)
-
-    def apply(self):
-        pass
-
-class LanguageConfig(KickstartConfig):
-    """A class to apply a kickstart language configuration to a system."""
-    @apply_wrapper
-    def apply(self, kslang):
-        self._check_sysconfig()
-        if kslang.lang:
-            f = open(self.path("/etc/sysconfig/i18n"), "w+")
-            f.write("LANG=\"" + kslang.lang + "\"\n")
-            f.close()
-
-class KeyboardConfig(KickstartConfig):
-    """A class to apply a kickstart keyboard configuration to a system."""
-    @apply_wrapper
-    def apply(self, kskeyboard):
-        #
-        # FIXME:
-        #   should this impact the X keyboard config too?
-        #   or do we want to make X be able to do this mapping?
-        #
-        #k = rhpl.keyboard.Keyboard()
-        #if kskeyboard.keyboard:
-        #   k.set(kskeyboard.keyboard)
-        #k.write(self.instroot)
-        pass
-
-class TimezoneConfig(KickstartConfig):
-    """A class to apply a kickstart timezone configuration to a system."""
-    @apply_wrapper
-    def apply(self, kstimezone):
-        self._check_sysconfig()
-        tz = kstimezone.timezone or "America/New_York"
-        utc = str(kstimezone.isUtc)
-
-        f = open(self.path("/etc/sysconfig/clock"), "w+")
-        f.write("ZONE=\"" + tz + "\"\n")
-        f.write("UTC=" + utc + "\n")
-        f.close()
-        tz_source = "/usr/share/zoneinfo/%s" % (tz)
-        tz_dest = "/etc/localtime"
-        try:
-            cpcmd = fs.find_binary_inchroot('cp', self.instroot)
-            if cpcmd:
-                self.call([cpcmd, "-f", tz_source, tz_dest])
-            else:
-                cpcmd = fs.find_binary_path('cp')
-                subprocess.call([cpcmd, "-f",
-                                 self.path(tz_source),
-                                 self.path(tz_dest)])
-        except (IOError, OSError), (errno, msg):
-            raise errors.KsError("Timezone setting error: %s" % msg)
-
-class AuthConfig(KickstartConfig):
-    """A class to apply a kickstart authconfig configuration to a system."""
-    @apply_wrapper
-    def apply(self, ksauthconfig):
-        auth = ksauthconfig.authconfig or "--useshadow --enablemd5"
-        args = ["/usr/share/authconfig/authconfig.py", "--update", "--nostart"]
-        self.call(args + auth.split())
-
-class FirewallConfig(KickstartConfig):
-    """A class to apply a kickstart firewall configuration to a system."""
-    @apply_wrapper
-    def apply(self, ksfirewall):
-        #
-        # FIXME: should handle the rest of the options
-        #
-        if not os.path.exists(self.path("/usr/sbin/lokkit")):
-            return
-        if ksfirewall.enabled:
-            status = "--enabled"
-        else:
-            status = "--disabled"
-
-        self.call(["/usr/sbin/lokkit",
-                   "-f", "--quiet", "--nostart", status])
-
-class RootPasswordConfig(KickstartConfig):
-    """A class to apply a kickstart root password configuration to a system."""
-    def unset(self):
-        self.call(["/usr/bin/passwd", "-d", "root"])
-
-    def set_encrypted(self, password):
-        self.call(["/usr/sbin/usermod", "-p", password, "root"])
-
-    def set_unencrypted(self, password):
-        for p in ("/bin/echo", "/usr/sbin/chpasswd"):
-            if not os.path.exists("%s/%s" %(self.instroot, p)):
-                raise errors.KsError("Unable to set unencrypted password due "
-                                     "to lack of %s" % p)
-
-        p1 = subprocess.Popen(["/bin/echo", "root:%s" %password],
-                              stdout = subprocess.PIPE,
-                              preexec_fn = self.chroot)
-        p2 = subprocess.Popen(["/usr/sbin/chpasswd", "-m"],
-                              stdin = p1.stdout,
-                              stdout = subprocess.PIPE,
-                              preexec_fn = self.chroot)
-        p2.communicate()
-
-    @apply_wrapper
-    def apply(self, ksrootpw):
-        if ksrootpw.isCrypted:
-            self.set_encrypted(ksrootpw.password)
-        elif ksrootpw.password != "":
-            self.set_unencrypted(ksrootpw.password)
-        else:
-            self.unset()
-
-class UserConfig(KickstartConfig):
-    def set_empty_passwd(self, user):
-        self.call(["/usr/bin/passwd", "-d", user])
-
-    def set_encrypted_passwd(self, user, password):
-        self.call(["/usr/sbin/usermod", "-p", "%s" % password, user])
-
-    def set_unencrypted_passwd(self, user, password):
-        for p in ("/bin/echo", "/usr/sbin/chpasswd"):
-            if not os.path.exists("%s/%s" %(self.instroot, p)):
-                raise errors.KsError("Unable to set unencrypted password due "
-                                     "to lack of %s" % p)
-
-        p1 = subprocess.Popen(["/bin/echo", "%s:%s" %(user, password)],
-                              stdout = subprocess.PIPE,
-                              preexec_fn = self.chroot)
-        p2 = subprocess.Popen(["/usr/sbin/chpasswd", "-m"],
-                              stdin = p1.stdout,
-                              stdout = subprocess.PIPE,
-                              preexec_fn = self.chroot)
-        p2.communicate()
-
-    def addUser(self, userconfig):
-        args = [ "/usr/sbin/useradd" ]
-        if userconfig.groups:
-            args += [ "--groups", string.join(userconfig.groups, ",") ]
-        if userconfig.name:
-            args += [ "-m"]
-            args += [ "-d", "/home/%s" % userconfig.name  ]
-            args.append(userconfig.name)
-            try:
-                dev_null = os.open("/dev/null", os.O_WRONLY)
-                msger.debug('adding user with %s' % args)
-                subprocess.call(args,
-                                 stdout = dev_null,
-                                 stderr = dev_null,
-                                 preexec_fn = self.chroot)
-                os.close(dev_null)
-            except:
-                msger.warning('Cannot add user using "useradd"')
-
-            if userconfig.password not in (None, ""):
-                if userconfig.isCrypted:
-                    self.set_encrypted_passwd(userconfig.name,
-                                              userconfig.password)
-                else:
-                    self.set_unencrypted_passwd(userconfig.name,
-                                                userconfig.password)
-            else:
-                self.set_empty_passwd(userconfig.name)
-        else:
-            raise errors.KsError("Invalid kickstart command: %s" \
-                                 % userconfig.__str__())
-
-    @apply_wrapper
-    def apply(self, user):
-        for userconfig in user.userList:
-            self.addUser(userconfig)
-
-class ServicesConfig(KickstartConfig):
-    """A class to apply a kickstart services configuration to a system."""
-    @apply_wrapper
-    def apply(self, ksservices):
-        if not os.path.exists(self.path("/sbin/chkconfig")):
-            return
-        for s in ksservices.enabled:
-            self.call(["/sbin/chkconfig", s, "on"])
-        for s in ksservices.disabled:
-            self.call(["/sbin/chkconfig", s, "off"])
-
-class XConfig(KickstartConfig):
-    """A class to apply a kickstart X configuration to a system."""
-    @apply_wrapper
-    def apply(self, ksxconfig):
-        if ksxconfig.startX and os.path.exists(self.path("/etc/inittab")):
-            f = open(self.path("/etc/inittab"), "rw+")
-            buf = f.read()
-            buf = buf.replace("id:3:initdefault", "id:5:initdefault")
-            f.seek(0)
-            f.write(buf)
-            f.close()
-        if ksxconfig.defaultdesktop:
-            self._check_sysconfig()
-            f = open(self.path("/etc/sysconfig/desktop"), "w")
-            f.write("DESKTOP="+ksxconfig.defaultdesktop+"\n")
-            f.close()
-
-class DesktopConfig(KickstartConfig):
-    """A class to apply a kickstart desktop configuration to a system."""
-    @apply_wrapper
-    def apply(self, ksdesktop):
-        if ksdesktop.defaultdesktop:
-            self._check_sysconfig()
-            f = open(self.path("/etc/sysconfig/desktop"), "w")
-            f.write("DESKTOP="+ksdesktop.defaultdesktop+"\n")
-            f.close()
-            if os.path.exists(self.path("/etc/gdm/custom.conf")):
-                f = open(self.path("/etc/skel/.dmrc"), "w")
-                f.write("[Desktop]\n")
-                f.write("Session="+ksdesktop.defaultdesktop.lower()+"\n")
-                f.close()
-        if ksdesktop.session:
-            if os.path.exists(self.path("/etc/sysconfig/uxlaunch")):
-                f = open(self.path("/etc/sysconfig/uxlaunch"), "a+")
-                f.write("session="+ksdesktop.session.lower()+"\n")
-                f.close()
-        if ksdesktop.autologinuser:
-            self._check_sysconfig()
-            f = open(self.path("/etc/sysconfig/desktop"), "a+")
-            f.write("AUTOLOGIN_USER=" + ksdesktop.autologinuser + "\n")
-            f.close()
-            if os.path.exists(self.path("/etc/gdm/custom.conf")):
-                f = open(self.path("/etc/gdm/custom.conf"), "w")
-                f.write("[daemon]\n")
-                f.write("AutomaticLoginEnable=true\n")
-                f.write("AutomaticLogin=" + ksdesktop.autologinuser + "\n")
-                f.close()
-
-class MoblinRepoConfig(KickstartConfig):
-    """A class to apply a kickstart desktop configuration to a system."""
-    def __create_repo_section(self, repo, type, fd):
-        baseurl = None
-        mirrorlist = None
-        reposuffix = {"base":"", "debuginfo":"-debuginfo", "source":"-source"}
-        reponame = repo.name + reposuffix[type]
-        if type == "base":
-            if repo.baseurl:
-                baseurl = repo.baseurl
-            if repo.mirrorlist:
-                mirrorlist = repo.mirrorlist
-
-        elif type == "debuginfo":
-            if repo.baseurl:
-                if repo.baseurl.endswith("/"):
-                    baseurl = os.path.dirname(os.path.dirname(repo.baseurl))
-                else:
-                    baseurl = os.path.dirname(repo.baseurl)
-                baseurl += "/debug"
-
-            if repo.mirrorlist:
-                variant = repo.mirrorlist[repo.mirrorlist.find("$"):]
-                mirrorlist = repo.mirrorlist[0:repo.mirrorlist.find("$")]
-                mirrorlist += "debug" + "-" + variant
-
-        elif type == "source":
-            if repo.baseurl:
-                if repo.baseurl.endswith("/"):
-                    baseurl = os.path.dirname(
-                                 os.path.dirname(
-                                    os.path.dirname(repo.baseurl)))
-                else:
-                    baseurl = os.path.dirname(os.path.dirname(repo.baseurl))
-                baseurl += "/source"
-
-            if repo.mirrorlist:
-                variant = repo.mirrorlist[repo.mirrorlist.find("$"):]
-                mirrorlist = repo.mirrorlist[0:repo.mirrorlist.find("$")]
-                mirrorlist += "source" + "-" + variant
-
-        fd.write("[" + reponame + "]\n")
-        fd.write("name=" + reponame + "\n")
-        fd.write("failovermethod=priority\n")
-        if baseurl:
-            auth_url = re.compile(AUTH_URL_PTN)
-            m = auth_url.match(baseurl)
-            if m:
-                baseurl = "%s://%s" % (m.group('scheme'), m.group('url'))
-            fd.write("baseurl=" + baseurl + "\n")
-        if mirrorlist:
-            fd.write("mirrorlist=" + mirrorlist + "\n")
-        """ Skip saving proxy settings """
-        #if repo.proxy:
-        #    fd.write("proxy=" + repo.proxy + "\n")
-        #if repo.proxy_username:
-        #    fd.write("proxy_username=" + repo.proxy_username + "\n")
-        #if repo.proxy_password:
-        #    fd.write("proxy_password=" + repo.proxy_password + "\n")
-        if repo.gpgkey:
-            fd.write("gpgkey=" + repo.gpgkey + "\n")
-            fd.write("gpgcheck=1\n")
-        else:
-            fd.write("gpgcheck=0\n")
-        if type == "source" or type == "debuginfo" or repo.disable:
-            fd.write("enabled=0\n")
-        else:
-            fd.write("enabled=1\n")
-        fd.write("\n")
-
-    def __create_repo_file(self, repo, repodir):
-        fs.makedirs(self.path(repodir))
-        f = open(self.path(repodir + "/" + repo.name + ".repo"), "w")
-        self.__create_repo_section(repo, "base", f)
-        if repo.debuginfo:
-            self.__create_repo_section(repo, "debuginfo", f)
-        if repo.source:
-            self.__create_repo_section(repo, "source", f)
-        f.close()
-
-    @apply_wrapper
-    def apply(self, ksrepo, repodata, repourl):
-        for repo in ksrepo.repoList:
-            if repo.name in repourl:
-                repo.baseurl = repourl[repo.name]
-            if repo.save:
-                #self.__create_repo_file(repo, "/etc/yum.repos.d")
-                self.__create_repo_file(repo, "/etc/zypp/repos.d")
-        """ Import repo gpg keys """
-        if repodata:
-            for repo in repodata:
-                if repo['repokey']:
-                    runner.quiet(['rpm',
-                                  "--root=%s" % self.instroot,
-                                  "--import",
-                                  repo['repokey']])
-
-class RPMMacroConfig(KickstartConfig):
-    """A class to apply the specified rpm macros to the filesystem"""
-    @apply_wrapper
-    def apply(self, ks):
-        if not ks:
-            return
-        if not os.path.exists(self.path("/etc/rpm")):
-            os.mkdir(self.path("/etc/rpm"))
-        f = open(self.path("/etc/rpm/macros.imgcreate"), "w+")
-        if exclude_docs(ks):
-            f.write("%_excludedocs 1\n")
-        f.write("%__file_context_path %{nil}\n")
-        if inst_langs(ks) != None:
-            f.write("%_install_langs ")
-            f.write(inst_langs(ks))
-            f.write("\n")
-        f.close()
-
-class NetworkConfig(KickstartConfig):
-    """A class to apply a kickstart network configuration to a system."""
-    def write_ifcfg(self, network):
-        p = self.path("/etc/sysconfig/network-scripts/ifcfg-" + network.device)
-
-        f = file(p, "w+")
-        os.chmod(p, 0644)
-
-        f.write("DEVICE=%s\n" % network.device)
-        f.write("BOOTPROTO=%s\n" % network.bootProto)
-
-        if network.bootProto.lower() == "static":
-            if network.ip:
-                f.write("IPADDR=%s\n" % network.ip)
-            if network.netmask:
-                f.write("NETMASK=%s\n" % network.netmask)
-
-        if network.onboot:
-            f.write("ONBOOT=on\n")
-        else:
-            f.write("ONBOOT=off\n")
-
-        if network.essid:
-            f.write("ESSID=%s\n" % network.essid)
-
-        if network.ethtool:
-            if network.ethtool.find("autoneg") == -1:
-                network.ethtool = "autoneg off " + network.ethtool
-            f.write("ETHTOOL_OPTS=%s\n" % network.ethtool)
-
-        if network.bootProto.lower() == "dhcp":
-            if network.hostname:
-                f.write("DHCP_HOSTNAME=%s\n" % network.hostname)
-            if network.dhcpclass:
-                f.write("DHCP_CLASSID=%s\n" % network.dhcpclass)
-
-        if network.mtu:
-            f.write("MTU=%s\n" % network.mtu)
-
-        f.close()
-
-    def write_wepkey(self, network):
-        if not network.wepkey:
-            return
-
-        p = self.path("/etc/sysconfig/network-scripts/keys-" + network.device)
-        f = file(p, "w+")
-        os.chmod(p, 0600)
-        f.write("KEY=%s\n" % network.wepkey)
-        f.close()
-
-    def write_sysconfig(self, useipv6, hostname, gateway):
-        path = self.path("/etc/sysconfig/network")
-        f = file(path, "w+")
-        os.chmod(path, 0644)
-
-        f.write("NETWORKING=yes\n")
-
-        if useipv6:
-            f.write("NETWORKING_IPV6=yes\n")
-        else:
-            f.write("NETWORKING_IPV6=no\n")
-
-        if hostname:
-            f.write("HOSTNAME=%s\n" % hostname)
-        else:
-            f.write("HOSTNAME=localhost.localdomain\n")
-
-        if gateway:
-            f.write("GATEWAY=%s\n" % gateway)
-
-        f.close()
-
-    def write_hosts(self, hostname):
-        localline = ""
-        if hostname and hostname != "localhost.localdomain":
-            localline += hostname + " "
-            l = hostname.split(".")
-            if len(l) > 1:
-                localline += l[0] + " "
-        localline += "localhost.localdomain localhost"
-
-        path = self.path("/etc/hosts")
-        f = file(path, "w+")
-        os.chmod(path, 0644)
-        f.write("127.0.0.1\t\t%s\n" % localline)
-        f.write("::1\t\tlocalhost6.localdomain6 localhost6\n")
-        f.close()
-
-    def write_resolv(self, nodns, nameservers):
-        if nodns or not nameservers:
-            return
-
-        path = self.path("/etc/resolv.conf")
-        f = file(path, "w+")
-        os.chmod(path, 0644)
-
-        for ns in (nameservers):
-            if ns:
-                f.write("nameserver %s\n" % ns)
-
-        f.close()
-
-    @apply_wrapper
-    def apply(self, ksnet):
-        fs.makedirs(self.path("/etc/sysconfig/network-scripts"))
-
-        useipv6 = False
-        nodns = False
-        hostname = None
-        gateway = None
-        nameservers = None
-
-        for network in ksnet.network:
-            if not network.device:
-                raise errors.KsError("No --device specified with "
-                                            "network kickstart command")
-
-            if (network.onboot and network.bootProto.lower() != "dhcp" and
-                not (network.ip and network.netmask)):
-                raise errors.KsError("No IP address and/or netmask "
-                                            "specified with static "
-                                            "configuration for '%s'" %
-                                            network.device)
-
-            self.write_ifcfg(network)
-            self.write_wepkey(network)
-
-            if network.ipv6:
-                useipv6 = True
-            if network.nodns:
-                nodns = True
-
-            if network.hostname:
-                hostname = network.hostname
-            if network.gateway:
-                gateway = network.gateway
-
-            if network.nameserver:
-                nameservers = network.nameserver.split(",")
-
-        self.write_sysconfig(useipv6, hostname, gateway)
-        self.write_hosts(hostname)
-        self.write_resolv(nodns, nameservers)
-
-def use_installerfw(ks, feature):
-    """ Check if the installer framework has to be used for a feature
-    "feature". """
-
-    features = ks.handler.installerfw.features
-    if features:
-        if feature in features or "all" in features:
-            return True
-    return False
-
 def get_image_size(ks, default = None):
     __size = 0
     for p in ks.handler.partition.partitions:
@@ -665,21 +93,6 @@ def get_image_fsopts(ks, default = None):
             return p.fsopts
     return default
 
-def get_modules(ks):
-    devices = []
-    if isinstance(ks.handler.device, kscommands.device.FC3_Device):
-        devices.append(ks.handler.device)
-    else:
-        devices.extend(ks.handler.device.deviceList)
-
-    modules = []
-    for device in devices:
-        if not device.moduleName:
-            continue
-        modules.extend(device.moduleName.split(":"))
-
-    return modules
-
 def get_timeout(ks, default = None):
     if not hasattr(ks.handler.bootloader, "timeout"):
         return default
@@ -708,181 +121,5 @@ def get_default_kernel(ks, default = None):
         return default
     return ks.handler.bootloader.default
 
-def get_repos(ks, repo_urls=None):
-    repos = {}
-    for repo in ks.handler.repo.repoList:
-        inc = []
-        if hasattr(repo, "includepkgs"):
-            inc.extend(repo.includepkgs)
-
-        exc = []
-        if hasattr(repo, "excludepkgs"):
-            exc.extend(repo.excludepkgs)
-
-        baseurl = repo.baseurl
-        mirrorlist = repo.mirrorlist
-
-        if repo_urls and repo.name in repo_urls:
-            baseurl = repo_urls[repo.name]
-            mirrorlist = None
-
-        if repos.has_key(repo.name):
-            msger.warning("Overriding already specified repo %s" %(repo.name,))
-
-        proxy = None
-        if hasattr(repo, "proxy"):
-            proxy = repo.proxy
-        proxy_username = None
-        if hasattr(repo, "proxy_username"):
-            proxy_username = repo.proxy_username
-        proxy_password = None
-        if hasattr(repo, "proxy_password"):
-            proxy_password = repo.proxy_password
-        if hasattr(repo, "debuginfo"):
-            debuginfo = repo.debuginfo
-        if hasattr(repo, "source"):
-            source = repo.source
-        if hasattr(repo, "gpgkey"):
-            gpgkey = repo.gpgkey
-        if hasattr(repo, "disable"):
-            disable = repo.disable
-        ssl_verify = True
-        if hasattr(repo, "ssl_verify"):
-            ssl_verify = repo.ssl_verify == "yes"
-        nocache = False
-        if hasattr(repo, "nocache"):
-            nocache = repo.nocache
-        cost = None
-        if hasattr(repo, "cost"):
-            cost = repo.cost
-        priority = None
-        if hasattr(repo, "priority"):
-            priority = repo.priority
-
-        repos[repo.name] = (repo.name, baseurl, mirrorlist, inc, exc,
-                            proxy, proxy_username, proxy_password, debuginfo,
-                            source, gpgkey, disable, ssl_verify, nocache,
-                            cost, priority)
-
-    return repos.values()
-
-def convert_method_to_repo(ks):
-    try:
-        ks.handler.repo.methodToRepo()
-    except (AttributeError, kserrors.KickstartError):
-        pass
-
-def get_attachment(ks, required=()):
-    return ks.handler.attachment.packageList + list(required)
-
-def get_pre_packages(ks, required=()):
-    return ks.handler.prepackages.packageList + list(required)
-
-def get_packages(ks, required=()):
-    return ks.handler.packages.packageList + list(required)
-
-def get_groups(ks, required=()):
-    return ks.handler.packages.groupList + list(required)
-
-def get_excluded(ks, required=()):
-    return ks.handler.packages.excludedList + list(required)
-
 def get_partitions(ks):
     return ks.handler.partition.partitions
-
-def ignore_missing(ks):
-    return ks.handler.packages.handleMissing == ksconstants.KS_MISSING_IGNORE
-
-def exclude_docs(ks):
-    return ks.handler.packages.excludeDocs
-
-def inst_langs(ks):
-    if hasattr(ks.handler.packages, "instLange"):
-        return ks.handler.packages.instLange
-    elif hasattr(ks.handler.packages, "instLangs"):
-        return ks.handler.packages.instLangs
-    return ""
-
-def get_post_scripts(ks):
-    scripts = []
-    for s in ks.handler.scripts:
-        if s.type != ksparser.KS_SCRIPT_POST:
-            continue
-        scripts.append(s)
-    return scripts
-
-def add_repo(ks, repostr):
-    args = repostr.split()
-    repoobj = ks.handler.repo.parse(args[1:])
-    if repoobj and repoobj not in ks.handler.repo.repoList:
-        ks.handler.repo.repoList.append(repoobj)
-
-def remove_all_repos(ks):
-    while len(ks.handler.repo.repoList) != 0:
-        del ks.handler.repo.repoList[0]
-
-def remove_duplicate_repos(ks):
-    i = 0
-    j = i + 1
-    while True:
-        if len(ks.handler.repo.repoList) < 2:
-            break
-        if i >= len(ks.handler.repo.repoList) - 1:
-            break
-        name = ks.handler.repo.repoList[i].name
-        baseurl = ks.handler.repo.repoList[i].baseurl
-        if j < len(ks.handler.repo.repoList):
-            if (ks.handler.repo.repoList[j].name == name or \
-                ks.handler.repo.repoList[j].baseurl == baseurl):
-                del ks.handler.repo.repoList[j]
-            else:
-                j += 1
-            if j >= len(ks.handler.repo.repoList):
-                i += 1
-                j = i + 1
-        else:
-            i += 1
-            j = i + 1
-
-def resolve_groups(creatoropts, repometadata):
-    iszypp = False
-    if 'zypp' == creatoropts['pkgmgr']:
-        iszypp = True
-    ks = creatoropts['ks']
-
-    for repo in repometadata:
-        """ Mustn't replace group with package list if repo is ready for the
-            corresponding package manager.
-        """
-
-        if iszypp and repo["patterns"]:
-            continue
-        if not iszypp and repo["comps"]:
-            continue
-
-        # But we also must handle such cases, use zypp but repo only has comps,
-        # use yum but repo only has patterns, use zypp but use_comps is true,
-        # use yum but use_comps is false.
-        groupfile = None
-        if iszypp and repo["comps"]:
-            groupfile = repo["comps"]
-            get_pkglist_handler = misc.get_pkglist_in_comps
-        if not iszypp and repo["patterns"]:
-            groupfile = repo["patterns"]
-            get_pkglist_handler = misc.get_pkglist_in_patterns
-
-        if groupfile:
-            i = 0
-            while True:
-                if i >= len(ks.handler.packages.groupList):
-                    break
-                pkglist = get_pkglist_handler(
-                                        ks.handler.packages.groupList[i].name,
-                                        groupfile)
-                if pkglist:
-                    del ks.handler.packages.groupList[i]
-                    for pkg in pkglist:
-                        if pkg not in ks.handler.packages.packageList:
-                            ks.handler.packages.packageList.append(pkg)
-                else:
-                    i = i + 1
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 04/35] wic: Remove mic bootstrap
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (2 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 03/35] wic: Remove packaging, config commands Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 05/35] wic: Remove mic chroot Tom Zanussi
                   ` (30 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

packaging bootstrap, not needed

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/bootstrap.py | 279 -------------------------------------------
 1 file changed, 279 deletions(-)
 delete mode 100644 scripts/lib/mic/bootstrap.py

diff --git a/scripts/lib/mic/bootstrap.py b/scripts/lib/mic/bootstrap.py
deleted file mode 100644
index 66c291b..0000000
--- a/scripts/lib/mic/bootstrap.py
+++ /dev/null
@@ -1,279 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2009, 2010, 2011 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from __future__ import with_statement
-import os
-import sys
-import tempfile
-import shutil
-import subprocess
-import rpm
-from mic import msger
-from mic.utils import errors, proxy, misc
-from mic.utils.rpmmisc import readRpmHeader, RPMInstallCallback
-from mic.chroot import cleanup_mounts, setup_chrootenv, cleanup_chrootenv
-
-PATH_BOOTSTRAP = "/usr/sbin:/usr/bin:/sbin:/bin"
-
-RPMTRANS_FLAGS = [
-                   rpm.RPMTRANS_FLAG_ALLFILES,
-                   rpm.RPMTRANS_FLAG_NOSCRIPTS,
-                   rpm.RPMTRANS_FLAG_NOTRIGGERS,
-                 ]
-
-RPMVSF_FLAGS = [
-                 rpm._RPMVSF_NOSIGNATURES,
-                 rpm._RPMVSF_NODIGESTS
-               ]
-
-RPMPROB_FLAGS = [
-                  rpm.RPMPROB_FILTER_OLDPACKAGE,
-                  rpm.RPMPROB_FILTER_REPLACEPKG,
-                  rpm.RPMPROB_FILTER_IGNOREARCH
-                ]
-
-class MiniBackend(object):
-    def __init__(self, rootdir, arch=None, repomd=None):
-        self._ts = None
-        self.rootdir = os.path.abspath(rootdir)
-        self.arch = arch
-        self.repomd = repomd
-        self.dlpkgs = []
-        self.localpkgs = {}
-        self.optionals = []
-        self.preins = {}
-        self.postins = {}
-        self.scriptlets = False
-
-    def __del__(self):
-        try:
-            del self.ts
-        except:
-            pass
-
-    def get_ts(self):
-        if not self._ts:
-            self._ts = rpm.TransactionSet(self.rootdir)
-            self._ts.setFlags(reduce(lambda x, y: x|y, RPMTRANS_FLAGS))
-            self._ts.setVSFlags(reduce(lambda x, y: x|y, RPMVSF_FLAGS))
-            self._ts.setProbFilter(reduce(lambda x, y: x|y, RPMPROB_FLAGS))
-
-        return self._ts
-
-    def del_ts(self):
-        if self._ts:
-            self._ts.closeDB()
-            self._ts = None
-
-    ts = property(fget = lambda self: self.get_ts(),
-                  fdel = lambda self: self.del_ts(),
-                  doc="TransactionSet object")
-
-    def selectPackage(self, pkg):
-        if not pkg in self.dlpkgs:
-            self.dlpkgs.append(pkg)
-
-    def runInstall(self):
-        # FIXME: check space
-        self.downloadPkgs()
-        self.installPkgs()
-
-        if not self.scriptlets:
-            return
-
-        for pkg in self.preins.keys():
-            prog, script = self.preins[pkg]
-            self.run_pkg_script(pkg, prog, script, '0')
-        for pkg in self.postins.keys():
-            prog, script = self.postins[pkg]
-            self.run_pkg_script(pkg, prog, script, '1')
-
-    def downloadPkgs(self):
-        nonexist = []
-        for pkg in self.dlpkgs:
-            localpth = misc.get_package(pkg, self.repomd, self.arch)
-            if localpth:
-                self.localpkgs[pkg] = localpth
-            elif pkg in self.optionals:
-                # skip optional rpm
-                continue
-            else:
-                # mark nonexist rpm
-                nonexist.append(pkg)
-
-        if nonexist:
-            raise errors.BootstrapError("Can't get rpm binary: %s" %
-                                        ','.join(nonexist))
-
-    def installPkgs(self):
-        for pkg in self.localpkgs.keys():
-            rpmpath = self.localpkgs[pkg]
-
-            hdr = readRpmHeader(self.ts, rpmpath)
-
-            # save prein and postin scripts
-            self.preins[pkg] = (hdr['PREINPROG'], hdr['PREIN'])
-            self.postins[pkg] = (hdr['POSTINPROG'], hdr['POSTIN'])
-
-            # mark pkg as install
-            self.ts.addInstall(hdr, rpmpath, 'u')
-
-        # run transaction
-        self.ts.order()
-        cb = RPMInstallCallback(self.ts)
-        self.ts.run(cb.callback, '')
-
-    def run_pkg_script(self, pkg, prog, script, arg):
-        mychroot = lambda: os.chroot(self.rootdir)
-
-        if not script:
-            return
-
-        if prog == "<lua>":
-            prog = "/usr/bin/lua"
-
-        tmpdir = os.path.join(self.rootdir, "tmp")
-        if not os.path.exists(tmpdir):
-            os.makedirs(tmpdir)
-        tmpfd, tmpfp = tempfile.mkstemp(dir=tmpdir, prefix="%s.pre-" % pkg)
-        script = script.replace('\r', '')
-        os.write(tmpfd, script)
-        os.close(tmpfd)
-        os.chmod(tmpfp, 0700)
-
-        try:
-            script_fp = os.path.join('/tmp', os.path.basename(tmpfp))
-            subprocess.call([prog, script_fp, arg], preexec_fn=mychroot)
-        except (OSError, IOError), err:
-            msger.warning(str(err))
-        finally:
-            os.unlink(tmpfp)
-
-class Bootstrap(object):
-    def __init__(self, rootdir, distro, arch=None):
-        self.rootdir = misc.mkdtemp(dir=rootdir, prefix=distro)
-        self.distro = distro
-        self.arch = arch
-        self.logfile = None
-        self.pkgslist = []
-        self.repomd = None
-
-    def __del__(self):
-        self.cleanup()
-
-    def get_rootdir(self):
-        if os.path.exists(self.rootdir):
-            shutil.rmtree(self.rootdir, ignore_errors=True)
-        os.makedirs(self.rootdir)
-        return self.rootdir
-
-    def dirsetup(self, rootdir=None):
-        _path = lambda pth: os.path.join(rootdir, pth.lstrip('/'))
-
-        if not rootdir:
-            rootdir = self.rootdir
-
-        try:
-            # make /tmp and /etc path
-            tmpdir = _path('/tmp')
-            if not os.path.exists(tmpdir):
-                os.makedirs(tmpdir)
-            etcdir = _path('/etc')
-            if not os.path.exists(etcdir):
-                os.makedirs(etcdir)
-
-            # touch distro file
-            tzdist = _path('/etc/%s-release' % self.distro)
-            if not os.path.exists(tzdist):
-                with open(tzdist, 'w') as wf:
-                    wf.write("bootstrap")
-        except:
-            pass
-
-    def create(self, repomd, pkglist, optlist=()):
-        try:
-            pkgmgr = MiniBackend(self.get_rootdir())
-            pkgmgr.arch = self.arch
-            pkgmgr.repomd = repomd
-            pkgmgr.optionals = list(optlist)
-            map(pkgmgr.selectPackage, pkglist + list(optlist))
-            pkgmgr.runInstall()
-        except (OSError, IOError, errors.CreatorError), err:
-            raise errors.BootstrapError("%s" % err)
-
-    def run(self, cmd, chdir, rootdir=None, bindmounts=None):
-        def mychroot():
-            os.chroot(rootdir)
-            os.chdir(chdir)
-
-        def sync_timesetting(rootdir):
-            try:
-                # sync time and zone info to bootstrap
-                if os.path.exists(rootdir + "/etc/localtime"):
-                    os.unlink(rootdir + "/etc/localtime")
-                shutil.copyfile("/etc/localtime", rootdir + "/etc/localtime")
-            except:
-                pass
-
-        def sync_passwdfile(rootdir):
-            try:
-                # sync passwd file to bootstrap, saving the user info
-                if os.path.exists(rootdir + "/etc/passwd"):
-                    os.unlink(rootdir + "/etc/passwd")
-                shutil.copyfile("/etc/passwd", rootdir + "/etc/passwd")
-            except:
-                pass
-
-        if not rootdir:
-            rootdir = self.rootdir
-
-        if isinstance(cmd, list):
-            shell = False
-        else:
-            shell = True
-
-        env = os.environ
-        env['PATH'] = "%s:%s" % (PATH_BOOTSTRAP, env['PATH'])
-
-        retcode = 0
-        gloablmounts = None
-        try:
-            proxy.set_proxy_environ()
-            gloablmounts = setup_chrootenv(rootdir, bindmounts, False)
-            sync_timesetting(rootdir)
-            sync_passwdfile(rootdir)
-            retcode = subprocess.call(cmd, preexec_fn=mychroot, env=env, shell=shell)
-        except (OSError, IOError):
-            # add additional information to original exception
-            value, tb = sys.exc_info()[1:]
-            value = '%s: %s' % (value, ' '.join(cmd))
-            raise RuntimeError, value, tb
-        finally:
-            if self.logfile and os.path.isfile(self.logfile):
-                msger.log(file(self.logfile).read())
-            cleanup_chrootenv(rootdir, bindmounts, gloablmounts)
-            proxy.unset_proxy_environ()
-        return retcode
-
-    def cleanup(self):
-        try:
-            # clean mounts
-            cleanup_mounts(self.rootdir)
-            # remove rootdir
-            shutil.rmtree(self.rootdir, ignore_errors=True)
-        except:
-            pass
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 05/35] wic: Remove mic chroot
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (3 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 04/35] wic: Remove mic bootstrap Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 06/35] wic: Remove rt_util Tom Zanussi
                   ` (29 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

mic chroot allows users to chroot into an existing mic image and isn't
used by wic, so remove it.

Removing chroot.py leads in turn to various plugin-loading failures
for a number of plugins that wic doesn't use either, so remove those
as well.

The existing source plugins refer to chroot but don't use it, so fix
those up.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/chroot.py                        | 343 -----------
 scripts/lib/mic/imager/fs.py                     |  99 ---
 scripts/lib/mic/imager/livecd.py                 | 750 -----------------------
 scripts/lib/mic/imager/liveusb.py                | 308 ----------
 scripts/lib/mic/imager/loop.py                   | 418 -------------
 scripts/lib/mic/imager/raw.py                    | 501 ---------------
 scripts/lib/mic/plugins/imager/direct_plugin.py  |   2 +-
 scripts/lib/mic/plugins/imager/fs_plugin.py      | 143 -----
 scripts/lib/mic/plugins/imager/livecd_plugin.py  | 255 --------
 scripts/lib/mic/plugins/imager/liveusb_plugin.py | 260 --------
 scripts/lib/mic/plugins/imager/loop_plugin.py    | 255 --------
 scripts/lib/mic/plugins/imager/raw_plugin.py     | 275 ---------
 scripts/lib/mic/plugins/source/bootimg-efi.py    |   2 +-
 scripts/lib/mic/plugins/source/bootimg-pcbios.py |   2 +-
 scripts/lib/mic/plugins/source/rootfs.py         |   2 +-
 15 files changed, 4 insertions(+), 3611 deletions(-)
 delete mode 100644 scripts/lib/mic/chroot.py
 delete mode 100644 scripts/lib/mic/imager/fs.py
 delete mode 100644 scripts/lib/mic/imager/livecd.py
 delete mode 100644 scripts/lib/mic/imager/liveusb.py
 delete mode 100644 scripts/lib/mic/imager/loop.py
 delete mode 100644 scripts/lib/mic/imager/raw.py
 delete mode 100644 scripts/lib/mic/plugins/imager/fs_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/livecd_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/liveusb_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/loop_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/raw_plugin.py

Patch too large to post - see git repository.

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 06/35] wic: Remove rt_util
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (4 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 05/35] wic: Remove mic chroot Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 07/35] wic: Remove mic package managers Tom Zanussi
                   ` (28 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

More package-related stuff we don't need.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/rt_util.py | 223 ---------------------------------------------
 1 file changed, 223 deletions(-)
 delete mode 100644 scripts/lib/mic/rt_util.py

diff --git a/scripts/lib/mic/rt_util.py b/scripts/lib/mic/rt_util.py
deleted file mode 100644
index 2a31f4a..0000000
--- a/scripts/lib/mic/rt_util.py
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2009, 2010, 2011 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from __future__ import with_statement
-import os
-import sys
-import glob
-import re
-import shutil
-import subprocess
-
-from mic import bootstrap, msger
-from mic.conf import configmgr
-from mic.utils import errors, proxy
-from mic.utils.fs_related import find_binary_path, makedirs
-from mic.chroot import setup_chrootenv, cleanup_chrootenv
-
-expath = lambda p: os.path.abspath(os.path.expanduser(p))
-
-def bootstrap_mic(argv=None):
-
-
-    def mychroot():
-        os.chroot(rootdir)
-        os.chdir(cwd)
-
-    # by default, sys.argv is used to run mic in bootstrap
-    if not argv:
-        argv = sys.argv
-    if argv[0] not in ('/usr/bin/mic', 'mic'):
-        argv[0] = '/usr/bin/mic'
-
-    cropts = configmgr.create
-    bsopts = configmgr.bootstrap
-    distro = bsopts['distro_name'].lower()
-
-    rootdir = bsopts['rootdir']
-    pkglist = bsopts['packages']
-    cwd = os.getcwd()
-
-    # create bootstrap and run mic in bootstrap
-    bsenv = bootstrap.Bootstrap(rootdir, distro, cropts['arch'])
-    bsenv.logfile = cropts['logfile']
-    # rootdir is regenerated as a temp dir
-    rootdir = bsenv.rootdir
-
-    if 'optional' in bsopts:
-        optlist = bsopts['optional']
-    else:
-        optlist = []
-
-    try:
-        msger.info("Creating %s bootstrap ..." % distro)
-        bsenv.create(cropts['repomd'], pkglist, optlist)
-
-        # bootstrap is relocated under "bootstrap"
-        if os.path.exists(os.path.join(rootdir, "bootstrap")):
-            rootdir = os.path.join(rootdir, "bootstrap")
-
-        bsenv.dirsetup(rootdir)
-        sync_mic(rootdir)
-
-        #FIXME: sync the ks file to bootstrap
-        if "/" == os.path.dirname(os.path.abspath(configmgr._ksconf)):
-            safecopy(configmgr._ksconf, rootdir)
-
-        msger.info("Start mic in bootstrap: %s\n" % rootdir)
-        bindmounts = get_bindmounts(cropts)
-        ret = bsenv.run(argv, cwd, rootdir, bindmounts)
-
-    except errors.BootstrapError, err:
-        msger.warning('\n%s' % err)
-        if msger.ask("Switch to native mode and continue?"):
-            return
-        raise
-    except RuntimeError, err:
-        #change exception type but keep the trace back
-        value, tb = sys.exc_info()[1:]
-        raise errors.BootstrapError, value, tb
-    else:
-        sys.exit(ret)
-    finally:
-        bsenv.cleanup()
-
-def get_bindmounts(cropts):
-    binddirs =  [
-                  os.getcwd(),
-                  cropts['tmpdir'],
-                  cropts['cachedir'],
-                  cropts['outdir'],
-                  cropts['local_pkgs_path'],
-                ]
-    bindfiles = [
-                  cropts['logfile'],
-                  configmgr._ksconf,
-                ]
-
-    for lrepo in cropts['localrepos']:
-        binddirs.append(lrepo)
-
-    bindlist = map(expath, filter(None, binddirs))
-    bindlist += map(os.path.dirname, map(expath, filter(None, bindfiles)))
-    bindlist = sorted(set(bindlist))
-    bindmounts = ';'.join(bindlist)
-    return bindmounts
-
-
-def get_mic_binpath():
-    fp = None
-    try:
-        import pkg_resources # depends on 'setuptools'
-    except ImportError:
-        pass
-    else:
-        dist = pkg_resources.get_distribution('mic')
-        # the real script is under EGG_INFO/scripts
-        if dist.has_metadata('scripts/mic'):
-            fp = os.path.join(dist.egg_info, "scripts/mic")
-
-    if fp:
-        return fp
-
-    # not found script if 'flat' egg installed
-    try:
-        return find_binary_path('mic')
-    except errors.CreatorError:
-        raise errors.BootstrapError("Can't find mic binary in host OS")
-
-
-def get_mic_modpath():
-    try:
-        import mic
-    except ImportError:
-        raise errors.BootstrapError("Can't find mic module in host OS")
-    path = os.path.abspath(mic.__file__)
-    return os.path.dirname(path)
-
-def get_mic_libpath():
-    # TBD: so far mic lib path is hard coded
-    return "/usr/lib/mic"
-
-# the hard code path is prepared for bootstrap
-def sync_mic(bootstrap, binpth = '/usr/bin/mic',
-             libpth='/usr/lib',
-             pylib = '/usr/lib/python2.7/site-packages',
-             conf = '/etc/mic/mic.conf'):
-    _path = lambda p: os.path.join(bootstrap, p.lstrip('/'))
-
-    micpaths = {
-                 'binpth': get_mic_binpath(),
-                 'libpth': get_mic_libpath(),
-                 'pylib': get_mic_modpath(),
-                 'conf': '/etc/mic/mic.conf',
-               }
-
-    if not os.path.exists(_path(pylib)):
-        pyptn = '/usr/lib/python?.?/site-packages'
-        pylibs = glob.glob(_path(pyptn))
-        if pylibs:
-            pylib = pylibs[0].replace(bootstrap, '')
-        else:
-            raise errors.BootstrapError("Can't find python site dir in: %s" %
-                                        bootstrap)
-
-    for key, value in micpaths.items():
-        try:
-            safecopy(value, _path(eval(key)), False, ["*.pyc", "*.pyo"])
-        except (OSError, IOError), err:
-            raise errors.BootstrapError(err)
-
-    # auto select backend
-    conf_str = file(_path(conf)).read()
-    conf_str = re.sub("pkgmgr\s*=\s*.*", "pkgmgr=auto", conf_str)
-    with open(_path(conf), 'w') as wf:
-        wf.write(conf_str)
-
-    # chmod +x /usr/bin/mic
-    os.chmod(_path(binpth), 0777)
-
-    # correct python interpreter
-    mic_cont = file(_path(binpth)).read()
-    mic_cont = "#!/usr/bin/python\n" + mic_cont
-    with open(_path(binpth), 'w') as wf:
-        wf.write(mic_cont)
-
-
-def safecopy(src, dst, symlinks=False, ignore_ptns=()):
-    if os.path.isdir(src):
-        if os.path.isdir(dst):
-            dst = os.path.join(dst, os.path.basename(src))
-        if os.path.exists(dst):
-            shutil.rmtree(dst, ignore_errors=True)
-
-        src = src.rstrip('/')
-        # check common prefix to ignore copying itself
-        if dst.startswith(src + '/'):
-            ignore_ptns = list(ignore_ptns) + [ os.path.basename(src) ]
-
-        ignores = shutil.ignore_patterns(*ignore_ptns)
-        try:
-            shutil.copytree(src, dst, symlinks, ignores)
-        except (OSError, IOError):
-            shutil.rmtree(dst, ignore_errors=True)
-            raise
-    else:
-        if not os.path.isdir(dst):
-            makedirs(os.path.dirname(dst))
-
-        shutil.copy2(src, dst)
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 07/35] wic: Remove mic package managers
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (5 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 06/35] wic: Remove rt_util Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 08/35] wic: Remove bmap support Tom Zanussi
                   ` (27 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use the yum or zypp package managers, remove them.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/plugins/backend/yumpkgmgr.py  | 490 -------------
 scripts/lib/mic/plugins/backend/zypppkgmgr.py | 973 --------------------------
 2 files changed, 1463 deletions(-)
 delete mode 100644 scripts/lib/mic/plugins/backend/yumpkgmgr.py
 delete mode 100755 scripts/lib/mic/plugins/backend/zypppkgmgr.py

Patch too large to post - see git repository.

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 08/35] wic: Remove bmap support
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (6 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 07/35] wic: Remove mic package managers Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 09/35] wic: Remove fiemap support Tom Zanussi
                   ` (26 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use it, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/BmapCreate.py | 298 ------------------------------------
 1 file changed, 298 deletions(-)
 delete mode 100644 scripts/lib/mic/utils/BmapCreate.py

diff --git a/scripts/lib/mic/utils/BmapCreate.py b/scripts/lib/mic/utils/BmapCreate.py
deleted file mode 100644
index 65b19a5..0000000
--- a/scripts/lib/mic/utils/BmapCreate.py
+++ /dev/null
@@ -1,298 +0,0 @@
-""" This module implements the block map (bmap) creation functionality and
-provides the corresponding API in form of the 'BmapCreate' class.
-
-The idea is that while images files may generally be very large (e.g., 4GiB),
-they may nevertheless contain only little real data, e.g., 512MiB. This data
-are files, directories, file-system meta-data, partition table, etc. When
-copying the image to the target device, you do not have to copy all the 4GiB of
-data, you can copy only 512MiB of it, which is 4 times less, so copying should
-presumably be 4 times faster.
-
-The block map file is an XML file which contains a list of blocks which have to
-be copied to the target device. The other blocks are not used and there is no
-need to copy them. The XML file also contains some additional information like
-block size, image size, count of mapped blocks, etc. There are also many
-commentaries, so it is human-readable.
-
-The image has to be a sparse file. Generally, this means that when you generate
-this image file, you should start with a huge sparse file which contains a
-single hole spanning the entire file. Then you should partition it, write all
-the data (probably by means of loop-back mounting the image or parts of it),
-etc. The end result should be a sparse file where mapped areas represent useful
-parts of the image and holes represent useless parts of the image, which do not
-have to be copied when copying the image to the target device.
-
-This module uses the FIBMAP ioctl to detect holes. """
-
-# Disable the following pylint recommendations:
-#   *  Too many instance attributes - R0902
-#   *  Too few public methods - R0903
-# pylint: disable=R0902,R0903
-
-import hashlib
-from mic.utils.misc import human_size
-from mic.utils import Fiemap
-
-# The bmap format version we generate
-SUPPORTED_BMAP_VERSION = "1.3"
-
-_BMAP_START_TEMPLATE = \
-"""<?xml version="1.0" ?>
-<!-- This file contains the block map for an image file, which is basically
-     a list of useful (mapped) block numbers in the image file. In other words,
-     it lists only those blocks which contain data (boot sector, partition
-     table, file-system metadata, files, directories, extents, etc). These
-     blocks have to be copied to the target device. The other blocks do not
-     contain any useful data and do not have to be copied to the target
-     device.
-
-     The block map an optimization which allows to copy or flash the image to
-     the image quicker than copying of flashing the entire image. This is
-     because with bmap less data is copied: <MappedBlocksCount> blocks instead
-     of <BlocksCount> blocks.
-
-     Besides the machine-readable data, this file contains useful commentaries
-     which contain human-readable information like image size, percentage of
-     mapped data, etc.
-
-     The 'version' attribute is the block map file format version in the
-     'major.minor' format. The version major number is increased whenever an
-     incompatible block map format change is made. The minor number changes
-     in case of minor backward-compatible changes. -->
-
-<bmap version="%s">
-    <!-- Image size in bytes: %s -->
-    <ImageSize> %u </ImageSize>
-
-    <!-- Size of a block in bytes -->
-    <BlockSize> %u </BlockSize>
-
-    <!-- Count of blocks in the image file -->
-    <BlocksCount> %u </BlocksCount>
-
-"""
-
-class Error(Exception):
-    """ A class for exceptions generated by this module. We currently support
-    only one type of exceptions, and we basically throw human-readable problem
-    description in case of errors. """
-    pass
-
-class BmapCreate:
-    """ This class implements the bmap creation functionality. To generate a
-    bmap for an image (which is supposedly a sparse file), you should first
-    create an instance of 'BmapCreate' and provide:
-
-    * full path or a file-like object of the image to create bmap for
-    * full path or a file object to use for writing the results to
-
-    Then you should invoke the 'generate()' method of this class. It will use
-    the FIEMAP ioctl to generate the bmap. """
-
-    def _open_image_file(self):
-        """ Open the image file. """
-
-        try:
-            self._f_image = open(self._image_path, 'rb')
-        except IOError as err:
-            raise Error("cannot open image file '%s': %s" \
-                        % (self._image_path, err))
-
-        self._f_image_needs_close = True
-
-    def _open_bmap_file(self):
-        """ Open the bmap file. """
-
-        try:
-            self._f_bmap = open(self._bmap_path, 'w+')
-        except IOError as err:
-            raise Error("cannot open bmap file '%s': %s" \
-                        % (self._bmap_path, err))
-
-        self._f_bmap_needs_close = True
-
-    def __init__(self, image, bmap):
-        """ Initialize a class instance:
-        * image - full path or a file-like object of the image to create bmap
-                  for
-        * bmap  - full path or a file object to use for writing the resulting
-                  bmap to """
-
-        self.image_size = None
-        self.image_size_human = None
-        self.block_size = None
-        self.blocks_cnt = None
-        self.mapped_cnt = None
-        self.mapped_size = None
-        self.mapped_size_human = None
-        self.mapped_percent = None
-
-        self._mapped_count_pos1 = None
-        self._mapped_count_pos2 = None
-        self._sha1_pos = None
-
-        self._f_image_needs_close = False
-        self._f_bmap_needs_close = False
-
-        if hasattr(image, "read"):
-            self._f_image = image
-            self._image_path = image.name
-        else:
-            self._image_path = image
-            self._open_image_file()
-
-        if hasattr(bmap, "read"):
-            self._f_bmap = bmap
-            self._bmap_path = bmap.name
-        else:
-            self._bmap_path = bmap
-            self._open_bmap_file()
-
-        self.fiemap = Fiemap.Fiemap(self._f_image)
-
-        self.image_size = self.fiemap.image_size
-        self.image_size_human = human_size(self.image_size)
-        if self.image_size == 0:
-            raise Error("cannot generate bmap for zero-sized image file '%s'" \
-                        % self._image_path)
-
-        self.block_size = self.fiemap.block_size
-        self.blocks_cnt = self.fiemap.blocks_cnt
-
-    def _bmap_file_start(self):
-        """ A helper function which generates the starting contents of the
-        block map file: the header comment, image size, block size, etc. """
-
-        # We do not know the amount of mapped blocks at the moment, so just put
-        # whitespaces instead of real numbers. Assume the longest possible
-        # numbers.
-        mapped_count = ' ' * len(str(self.image_size))
-        mapped_size_human = ' ' * len(self.image_size_human)
-
-        xml = _BMAP_START_TEMPLATE \
-               % (SUPPORTED_BMAP_VERSION, self.image_size_human,
-                  self.image_size, self.block_size, self.blocks_cnt)
-        xml += "    <!-- Count of mapped blocks: "
-
-        self._f_bmap.write(xml)
-        self._mapped_count_pos1 = self._f_bmap.tell()
-
-        # Just put white-spaces instead of real information about mapped blocks
-        xml  = "%s or %.1f    -->\n" % (mapped_size_human, 100.0)
-        xml += "    <MappedBlocksCount> "
-
-        self._f_bmap.write(xml)
-        self._mapped_count_pos2 = self._f_bmap.tell()
-
-        xml  = "%s </MappedBlocksCount>\n\n" % mapped_count
-
-        # pylint: disable=C0301
-        xml += "    <!-- The checksum of this bmap file. When it is calculated, the value of\n"
-        xml += "         the SHA1 checksum has be zeoro (40 ASCII \"0\" symbols). -->\n"
-        xml += "    <BmapFileSHA1> "
-
-        self._f_bmap.write(xml)
-        self._sha1_pos = self._f_bmap.tell()
-
-        xml = "0" * 40 + " </BmapFileSHA1>\n\n"
-        xml += "    <!-- The block map which consists of elements which may either be a\n"
-        xml += "         range of blocks or a single block. The 'sha1' attribute (if present)\n"
-        xml += "         is the SHA1 checksum of this blocks range. -->\n"
-        xml += "    <BlockMap>\n"
-        # pylint: enable=C0301
-
-        self._f_bmap.write(xml)
-
-    def _bmap_file_end(self):
-        """ A helper function which generates the final parts of the block map
-        file: the ending tags and the information about the amount of mapped
-        blocks. """
-
-        xml =  "    </BlockMap>\n"
-        xml += "</bmap>\n"
-
-        self._f_bmap.write(xml)
-
-        self._f_bmap.seek(self._mapped_count_pos1)
-        self._f_bmap.write("%s or %.1f%%" % \
-                           (self.mapped_size_human, self.mapped_percent))
-
-        self._f_bmap.seek(self._mapped_count_pos2)
-        self._f_bmap.write("%u" % self.mapped_cnt)
-
-        self._f_bmap.seek(0)
-        sha1 = hashlib.sha1(self._f_bmap.read()).hexdigest()
-        self._f_bmap.seek(self._sha1_pos)
-        self._f_bmap.write("%s" % sha1)
-
-    def _calculate_sha1(self, first, last):
-        """ A helper function which calculates SHA1 checksum for the range of
-        blocks of the image file: from block 'first' to block 'last'. """
-
-        start = first * self.block_size
-        end = (last + 1) * self.block_size
-
-        self._f_image.seek(start)
-        hash_obj = hashlib.new("sha1")
-
-        chunk_size = 1024*1024
-        to_read = end - start
-        read = 0
-
-        while read < to_read:
-            if read + chunk_size > to_read:
-                chunk_size = to_read - read
-            chunk = self._f_image.read(chunk_size)
-            hash_obj.update(chunk)
-            read += chunk_size
-
-        return hash_obj.hexdigest()
-
-    def generate(self, include_checksums = True):
-        """ Generate bmap for the image file. If 'include_checksums' is 'True',
-        also generate SHA1 checksums for block ranges. """
-
-        # Save image file position in order to restore it at the end
-        image_pos = self._f_image.tell()
-
-        self._bmap_file_start()
-
-        # Generate the block map and write it to the XML block map
-        # file as we go.
-        self.mapped_cnt = 0
-        for first, last in self.fiemap.get_mapped_ranges(0, self.blocks_cnt):
-            self.mapped_cnt += last - first + 1
-            if include_checksums:
-                sha1 = self._calculate_sha1(first, last)
-                sha1 = " sha1=\"%s\"" % sha1
-            else:
-                sha1 = ""
-
-            if first != last:
-                self._f_bmap.write("        <Range%s> %s-%s </Range>\n" \
-                                   % (sha1, first, last))
-            else:
-                self._f_bmap.write("        <Range%s> %s </Range>\n" \
-                                   % (sha1, first))
-
-        self.mapped_size = self.mapped_cnt * self.block_size
-        self.mapped_size_human = human_size(self.mapped_size)
-        self.mapped_percent = (self.mapped_cnt * 100.0) /  self.blocks_cnt
-
-        self._bmap_file_end()
-
-        try:
-            self._f_bmap.flush()
-        except IOError as err:
-            raise Error("cannot flush the bmap file '%s': %s" \
-                        % (self._bmap_path, err))
-
-        self._f_image.seek(image_pos)
-
-    def __del__(self):
-        """ The class destructor which closes the opened files. """
-
-        if self._f_image_needs_close:
-            self._f_image.close()
-        if self._f_bmap_needs_close:
-            self._f_bmap.close()
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 09/35] wic: Remove fiemap support
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (7 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 08/35] wic: Remove bmap support Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 10/35] wic: Remove grabber implementation Tom Zanussi
                   ` (25 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use it, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/Fiemap.py | 252 ----------------------------------------
 1 file changed, 252 deletions(-)
 delete mode 100644 scripts/lib/mic/utils/Fiemap.py

diff --git a/scripts/lib/mic/utils/Fiemap.py b/scripts/lib/mic/utils/Fiemap.py
deleted file mode 100644
index f2db6ff..0000000
--- a/scripts/lib/mic/utils/Fiemap.py
+++ /dev/null
@@ -1,252 +0,0 @@
-""" This module implements python API for the FIEMAP ioctl. The FIEMAP ioctl
-allows to find holes and mapped areas in a file. """
-
-# Note, a lot of code in this module is not very readable, because it deals
-# with the rather complex FIEMAP ioctl. To understand the code, you need to
-# know the FIEMAP interface, which is documented in the
-# Documentation/filesystems/fiemap.txt file in the Linux kernel sources.
-
-# Disable the following pylint recommendations:
-#   * Too many instance attributes (R0902)
-# pylint: disable=R0902
-
-import os
-import struct
-import array
-import fcntl
-from mic.utils.misc import get_block_size
-
-# Format string for 'struct fiemap'
-_FIEMAP_FORMAT = "=QQLLLL"
-# sizeof(struct fiemap)
-_FIEMAP_SIZE = struct.calcsize(_FIEMAP_FORMAT)
-# Format string for 'struct fiemap_extent'
-_FIEMAP_EXTENT_FORMAT = "=QQQQQLLLL"
-# sizeof(struct fiemap_extent)
-_FIEMAP_EXTENT_SIZE = struct.calcsize(_FIEMAP_EXTENT_FORMAT)
-# The FIEMAP ioctl number
-_FIEMAP_IOCTL = 0xC020660B
-
-# Minimum buffer which is required for 'class Fiemap' to operate
-MIN_BUFFER_SIZE = _FIEMAP_SIZE + _FIEMAP_EXTENT_SIZE
-# The default buffer size for 'class Fiemap'
-DEFAULT_BUFFER_SIZE = 256 * 1024
-
-class Error(Exception):
-    """ A class for exceptions generated by this module. We currently support
-    only one type of exceptions, and we basically throw human-readable problem
-    description in case of errors. """
-    pass
-
-class Fiemap:
-    """ This class provides API to the FIEMAP ioctl. Namely, it allows to
-    iterate over all mapped blocks and over all holes. """
-
-    def _open_image_file(self):
-        """ Open the image file. """
-
-        try:
-            self._f_image = open(self._image_path, 'rb')
-        except IOError as err:
-            raise Error("cannot open image file '%s': %s" \
-                        % (self._image_path, err))
-
-        self._f_image_needs_close = True
-
-    def __init__(self, image, buf_size = DEFAULT_BUFFER_SIZE):
-        """ Initialize a class instance. The 'image' argument is full path to
-        the file to operate on, or a file object to operate on.
-
-        The 'buf_size' argument is the size of the buffer for 'struct
-        fiemap_extent' elements which will be used when invoking the FIEMAP
-        ioctl. The larger is the buffer, the less times the FIEMAP ioctl will
-        be invoked. """
-
-        self._f_image_needs_close = False
-
-        if hasattr(image, "fileno"):
-            self._f_image = image
-            self._image_path = image.name
-        else:
-            self._image_path = image
-            self._open_image_file()
-
-        # Validate 'buf_size'
-        if buf_size < MIN_BUFFER_SIZE:
-            raise Error("too small buffer (%d bytes), minimum is %d bytes" \
-                    % (buf_size, MIN_BUFFER_SIZE))
-
-        # How many 'struct fiemap_extent' elements fit the buffer
-        buf_size -= _FIEMAP_SIZE
-        self._fiemap_extent_cnt = buf_size / _FIEMAP_EXTENT_SIZE
-        self._buf_size = self._fiemap_extent_cnt * _FIEMAP_EXTENT_SIZE
-        self._buf_size += _FIEMAP_SIZE
-
-        # Allocate a mutable buffer for the FIEMAP ioctl
-        self._buf = array.array('B', [0] * self._buf_size)
-
-        self.image_size = os.fstat(self._f_image.fileno()).st_size
-
-        try:
-            self.block_size = get_block_size(self._f_image)
-        except IOError as err:
-            raise Error("cannot get block size for '%s': %s" \
-                        % (self._image_path, err))
-
-        self.blocks_cnt = self.image_size + self.block_size - 1
-        self.blocks_cnt /= self.block_size
-
-        # Synchronize the image file to make sure FIEMAP returns correct values
-        try:
-            self._f_image.flush()
-        except IOError as err:
-            raise Error("cannot flush image file '%s': %s" \
-                        % (self._image_path, err))
-        try:
-            os.fsync(self._f_image.fileno()),
-        except OSError as err:
-            raise Error("cannot synchronize image file '%s': %s " \
-                        % (self._image_path, err.strerror))
-
-        # Check if the FIEMAP ioctl is supported
-        self.block_is_mapped(0)
-
-    def __del__(self):
-        """ The class destructor which closes the opened files. """
-
-        if self._f_image_needs_close:
-            self._f_image.close()
-
-    def _invoke_fiemap(self, block, count):
-        """ Invoke the FIEMAP ioctl for 'count' blocks of the file starting from
-        block number 'block'.
-
-        The full result of the operation is stored in 'self._buf' on exit.
-        Returns the unpacked 'struct fiemap' data structure in form of a python
-        list (just like 'struct.upack()'). """
-
-        if block < 0 or block >= self.blocks_cnt:
-            raise Error("bad block number %d, should be within [0, %d]" \
-                        % (block, self.blocks_cnt))
-
-        # Initialize the 'struct fiemap' part of the buffer
-        struct.pack_into(_FIEMAP_FORMAT, self._buf, 0, block * self.block_size,
-                         count * self.block_size, 0, 0,
-                         self._fiemap_extent_cnt, 0)
-
-        try:
-            fcntl.ioctl(self._f_image, _FIEMAP_IOCTL, self._buf, 1)
-        except IOError as err:
-            error_msg = "the FIEMAP ioctl failed for '%s': %s" \
-                        % (self._image_path, err)
-            if err.errno == os.errno.EPERM or err.errno == os.errno.EACCES:
-                # The FIEMAP ioctl was added in kernel version 2.6.28 in 2008
-                error_msg += " (looks like your kernel does not support FIEMAP)"
-
-            raise Error(error_msg)
-
-        return struct.unpack(_FIEMAP_FORMAT, self._buf[:_FIEMAP_SIZE])
-
-    def block_is_mapped(self, block):
-        """ This function returns 'True' if block number 'block' of the image
-        file is mapped and 'False' otherwise. """
-
-        struct_fiemap = self._invoke_fiemap(block, 1)
-
-        # The 3rd element of 'struct_fiemap' is the 'fm_mapped_extents' field.
-        # If it contains zero, the block is not mapped, otherwise it is
-        # mapped.
-        return bool(struct_fiemap[3])
-
-    def block_is_unmapped(self, block):
-        """ This function returns 'True' if block number 'block' of the image
-        file is not mapped (hole) and 'False' otherwise. """
-
-        return not self.block_is_mapped(block)
-
-    def _unpack_fiemap_extent(self, index):
-        """ Unpack a 'struct fiemap_extent' structure object number 'index'
-        from the internal 'self._buf' buffer. """
-
-        offset = _FIEMAP_SIZE + _FIEMAP_EXTENT_SIZE * index
-        return struct.unpack(_FIEMAP_EXTENT_FORMAT,
-                             self._buf[offset : offset + _FIEMAP_EXTENT_SIZE])
-
-    def _do_get_mapped_ranges(self, start, count):
-        """ Implements most the functionality for the  'get_mapped_ranges()'
-        generator: invokes the FIEMAP ioctl, walks through the mapped
-        extents and yields mapped block ranges. However, the ranges may be
-        consecutive (e.g., (1, 100), (100, 200)) and 'get_mapped_ranges()'
-        simply merges them. """
-
-        block = start
-        while block < start + count:
-            struct_fiemap = self._invoke_fiemap(block, count)
-
-            mapped_extents = struct_fiemap[3]
-            if mapped_extents == 0:
-                # No more mapped blocks
-                return
-
-            extent = 0
-            while extent < mapped_extents:
-                fiemap_extent = self._unpack_fiemap_extent(extent)
-
-                # Start of the extent
-                extent_start = fiemap_extent[0]
-                # Starting block number of the extent
-                extent_block = extent_start / self.block_size
-                # Length of the extent
-                extent_len = fiemap_extent[2]
-                # Count of blocks in the extent
-                extent_count = extent_len / self.block_size
-
-                # Extent length and offset have to be block-aligned
-                assert extent_start % self.block_size == 0
-                assert extent_len % self.block_size == 0
-
-                if extent_block > start + count - 1:
-                    return
-
-                first = max(extent_block, block)
-                last = min(extent_block + extent_count, start + count) - 1
-                yield (first, last)
-
-                extent += 1
-
-            block = extent_block + extent_count
-
-    def get_mapped_ranges(self, start, count):
-        """ A generator which yields ranges of mapped blocks in the file. The
-        ranges are tuples of 2 elements: [first, last], where 'first' is the
-        first mapped block and 'last' is the last mapped block.
-
-        The ranges are yielded for the area of the file of size 'count' blocks,
-        starting from block 'start'. """
-
-        iterator = self._do_get_mapped_ranges(start, count)
-
-        first_prev, last_prev = iterator.next()
-
-        for first, last in iterator:
-            if last_prev == first - 1:
-                last_prev = last
-            else:
-                yield (first_prev, last_prev)
-                first_prev, last_prev = first, last
-
-        yield (first_prev, last_prev)
-
-    def get_unmapped_ranges(self, start, count):
-        """ Just like 'get_mapped_ranges()', but yields unmapped block ranges
-        instead (holes). """
-
-        hole_first = start
-        for first, last in self._do_get_mapped_ranges(start, count):
-            if first > hole_first:
-                yield (hole_first, first - 1)
-
-            hole_first = last + 1
-
-        if hole_first < start + count:
-            yield (hole_first, start + count - 1)
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 10/35] wic: Remove grabber implementation
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (8 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 09/35] wic: Remove fiemap support Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 11/35] wic: Remove proxy support Tom Zanussi
                   ` (24 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't need to grab any urls, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/grabber.py | 97 ----------------------------------------
 1 file changed, 97 deletions(-)
 delete mode 100644 scripts/lib/mic/utils/grabber.py

diff --git a/scripts/lib/mic/utils/grabber.py b/scripts/lib/mic/utils/grabber.py
deleted file mode 100644
index 45e30b4..0000000
--- a/scripts/lib/mic/utils/grabber.py
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/python
-
-import os
-import sys
-import rpm
-import fcntl
-import struct
-import termios
-
-from mic import msger
-from mic.utils import runner
-from mic.utils.errors import CreatorError
-
-from urlgrabber import grabber
-from urlgrabber import __version__ as grabber_version
-
-if rpm.labelCompare(grabber_version.split('.'), '3.9.0'.split('.')) == -1:
-    msger.warning("Version of python-urlgrabber is %s, lower than '3.9.0', "
-                  "you may encounter some network issues" % grabber_version)
-
-def myurlgrab(url, filename, proxies, progress_obj = None):
-    g = grabber.URLGrabber()
-    if progress_obj is None:
-        progress_obj = TextProgress()
-
-    if url.startswith("file:/"):
-        filepath = "/%s" % url.replace("file:", "").lstrip('/')
-        if not os.path.exists(filepath):
-            raise CreatorError("URLGrabber error: can't find file %s" % url)
-        if url.endswith('.rpm'):
-            return filepath
-        else:
-            # untouch repometadata in source path
-            runner.show(['cp', '-f', filepath, filename])
-
-    else:
-        try:
-            filename = g.urlgrab(url=str(url),
-                                 filename=filename,
-                                 ssl_verify_host=False,
-                                 ssl_verify_peer=False,
-                                 proxies=proxies,
-                                 http_headers=(('Pragma', 'no-cache'),),
-                                 quote=0,
-                                 progress_obj=progress_obj)
-        except grabber.URLGrabError, err:
-            msg = str(err)
-            if msg.find(url) < 0:
-                msg += ' on %s' % url
-            raise CreatorError(msg)
-
-    return filename
-
-def terminal_width(fd=1):
-    """ Get the real terminal width """
-    try:
-        buf = 'abcdefgh'
-        buf = fcntl.ioctl(fd, termios.TIOCGWINSZ, buf)
-        return struct.unpack('hhhh', buf)[1]
-    except: # IOError
-        return 80
-
-def truncate_url(url, width):
-    return os.path.basename(url)[0:width]
-
-class TextProgress(object):
-    # make the class as singleton
-    _instance = None
-    def __new__(cls, *args, **kwargs):
-        if not cls._instance:
-            cls._instance = super(TextProgress, cls).__new__(cls, *args, **kwargs)
-
-        return cls._instance
-
-    def __init__(self, totalnum = None):
-        self.total = totalnum
-        self.counter = 1
-
-    def start(self, filename, url, *args, **kwargs):
-        self.url = url
-        self.termwidth = terminal_width()
-        msger.info("\r%-*s" % (self.termwidth, " "))
-        if self.total is None:
-            msger.info("\rRetrieving %s ..." % truncate_url(self.url, self.termwidth - 15))
-        else:
-            msger.info("\rRetrieving %s [%d/%d] ..." % (truncate_url(self.url, self.termwidth - 25), self.counter, self.total))
-
-    def update(self, *args):
-        pass
-
-    def end(self, *args):
-        if self.counter == self.total:
-            msger.raw("\n")
-
-        if self.total is not None:
-            self.counter += 1
-
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 11/35] wic: Remove proxy support
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (9 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 10/35] wic: Remove grabber implementation Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 12/35] wic: Remove rpmmisc Tom Zanussi
                   ` (23 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use proxy support, so remove it.

Also remove anything related to proxies in misc and conf, and while
we're at it, remove all the obviously unneeded code from those files -
it's easier to just remove it than to figure out the callchain to the
proxy code usages.

Basically the extra stuff relates to packaging, images, and config
files we don't use.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/conf.py        |  58 +--
 scripts/lib/mic/utils/misc.py  | 782 -----------------------------------------
 scripts/lib/mic/utils/proxy.py | 183 ----------
 3 files changed, 1 insertion(+), 1022 deletions(-)
 delete mode 100644 scripts/lib/mic/utils/proxy.py

diff --git a/scripts/lib/mic/conf.py b/scripts/lib/mic/conf.py
index b850d80..1fe6edd 100644
--- a/scripts/lib/mic/conf.py
+++ b/scripts/lib/mic/conf.py
@@ -20,7 +20,7 @@ import ConfigParser
 
 from mic import msger
 from mic import kickstart
-from mic.utils import misc, runner, proxy, errors
+from mic.utils import misc, runner, errors
 
 
 def get_siteconf():
@@ -55,8 +55,6 @@ class ConfigMgr(object):
                     "pack_to": None,
                     "name_prefix": None,
                     "name_suffix": None,
-                    "proxy": None,
-                    "no_proxy": None,
                     "copy_kernel": False,
                     "install_pkgs": None,
                     "repourl": {},
@@ -104,16 +102,6 @@ class ConfigMgr(object):
         for sec, vals in self.DEFAULTS.iteritems():
             setattr(self, sec, vals)
 
-    def __set_siteconf(self, siteconf):
-        try:
-            self.__siteconf = siteconf
-            self._parse_siteconf(siteconf)
-        except ConfigParser.Error, error:
-            raise errors.ConfigError("%s" % error)
-    def __get_siteconf(self):
-        return self.__siteconf
-    _siteconf = property(__get_siteconf, __set_siteconf)
-
     def __set_ksconf(self, ksconf):
         if not os.path.isfile(ksconf):
             msger.error('Cannot find ks file: %s' % ksconf)
@@ -124,50 +112,6 @@ class ConfigMgr(object):
         return self.__ksconf
     _ksconf = property(__get_ksconf, __set_ksconf)
 
-    def _parse_siteconf(self, siteconf):
-        if not siteconf:
-            return
-
-        if not os.path.exists(siteconf):
-            msger.warning("cannot read config file: %s" % siteconf)
-            return
-
-        parser = ConfigParser.SafeConfigParser()
-        parser.read(siteconf)
-
-        for section in parser.sections():
-            if section in self.DEFAULTS:
-                getattr(self, section).update(dict(parser.items(section)))
-
-        # append common section items to other sections
-        for section in self.DEFAULTS.keys():
-            if section != "common":
-                getattr(self, section).update(self.common)
-
-        # check and normalize the scheme of proxy url
-        if self.create['proxy']:
-            m = re.match('^(\w+)://.*', self.create['proxy'])
-            if m:
-                scheme = m.group(1)
-                if scheme not in ('http', 'https', 'ftp', 'socks'):
-                    msger.error("%s: proxy scheme is incorrect" % siteconf)
-            else:
-                msger.warning("%s: proxy url w/o scheme, use http as default"
-                              % siteconf)
-                self.create['proxy'] = "http://" + self.create['proxy']
-
-        proxy.set_proxies(self.create['proxy'], self.create['no_proxy'])
-
-        # bootstrap option handling
-        self.set_runtime(self.create['runtime'])
-        if isinstance(self.bootstrap['packages'], basestring):
-            packages = self.bootstrap['packages'].replace('\n', ' ')
-            if packages.find(',') != -1:
-                packages = packages.split(',')
-            else:
-                packages = packages.split()
-            self.bootstrap['packages'] = packages
-
     def _parse_kickstart(self, ksconf=None):
         if not ksconf:
             return
diff --git a/scripts/lib/mic/utils/misc.py b/scripts/lib/mic/utils/misc.py
index 95241d7..8c1f016 100644
--- a/scripts/lib/mic/utils/misc.py
+++ b/scripts/lib/mic/utils/misc.py
@@ -42,15 +42,8 @@ xmlparse = cElementTree.parse
 from mic import msger
 from mic.utils.errors import CreatorError, SquashfsError
 from mic.utils.fs_related import find_binary_path, makedirs
-from mic.utils.proxy import get_proxy_for
 from mic.utils import runner
 
-
-RPM_RE  = re.compile("(.*)\.(.*) (.*)-(.*)")
-RPM_FMT = "%(name)s.%(arch)s %(version)s-%(release)s"
-SRPM_RE = re.compile("(.*)-(\d+.*)-(\d+\.\d+).src.rpm")
-
-
 def build_name(kscfg, release=None, prefix = None, suffix = None):
     """Construct and return an image name string.
 
@@ -123,136 +116,6 @@ def get_distro_str():
 
 _LOOP_RULE_PTH = None
 
-def hide_loopdev_presentation():
-    udev_rules = "80-prevent-loop-present.rules"
-    udev_rules_dir = [
-                       '/usr/lib/udev/rules.d/',
-                       '/lib/udev/rules.d/',
-                       '/etc/udev/rules.d/'
-                     ]
-
-    global _LOOP_RULE_PTH
-
-    for rdir in udev_rules_dir:
-        if os.path.exists(rdir):
-            _LOOP_RULE_PTH = os.path.join(rdir, udev_rules)
-
-    if not _LOOP_RULE_PTH:
-        return
-
-    try:
-        with open(_LOOP_RULE_PTH, 'w') as wf:
-            wf.write('KERNEL=="loop*", ENV{UDISKS_PRESENTATION_HIDE}="1"')
-
-        runner.quiet('udevadm trigger')
-    except:
-        pass
-
-def unhide_loopdev_presentation():
-    global _LOOP_RULE_PTH
-
-    if not _LOOP_RULE_PTH:
-        return
-
-    try:
-        os.unlink(_LOOP_RULE_PTH)
-        runner.quiet('udevadm trigger')
-    except:
-        pass
-
-def extract_rpm(rpmfile, targetdir):
-    rpm2cpio = find_binary_path("rpm2cpio")
-    cpio = find_binary_path("cpio")
-
-    olddir = os.getcwd()
-    os.chdir(targetdir)
-
-    msger.verbose("Extract rpm file with cpio: %s" % rpmfile)
-    p1 = subprocess.Popen([rpm2cpio, rpmfile], stdout=subprocess.PIPE)
-    p2 = subprocess.Popen([cpio, "-idv"], stdin=p1.stdout,
-                          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    (sout, serr) = p2.communicate()
-    msger.verbose(sout or serr)
-
-    os.chdir(olddir)
-
-def compressing(fpath, method):
-    comp_map = {
-        "gz": "gzip",
-        "bz2": "bzip2"
-    }
-    if method not in comp_map:
-        raise CreatorError("Unsupport compress format: %s, valid values: %s"
-                           % (method, ','.join(comp_map.keys())))
-    cmd = find_binary_path(comp_map[method])
-    rc = runner.show([cmd, "-f", fpath])
-    if rc:
-        raise CreatorError("Failed to %s file: %s" % (comp_map[method], fpath))
-
-def taring(dstfile, target):
-    import tarfile
-    basen, ext = os.path.splitext(dstfile)
-    comp = {".tar": None,
-            ".gz": "gz", # for .tar.gz
-            ".bz2": "bz2", # for .tar.bz2
-            ".tgz": "gz",
-            ".tbz": "bz2"}[ext]
-
-    # specify tarball file path
-    if not comp:
-        tarpath = dstfile
-    elif basen.endswith(".tar"):
-        tarpath = basen
-    else:
-        tarpath = basen + ".tar"
-    wf = tarfile.open(tarpath, 'w')
-
-    if os.path.isdir(target):
-        for item in os.listdir(target):
-            wf.add(os.path.join(target, item), item)
-    else:
-        wf.add(target, os.path.basename(target))
-    wf.close()
-
-    if comp:
-        compressing(tarpath, comp)
-        # when dstfile ext is ".tgz" and ".tbz", should rename
-        if not basen.endswith(".tar"):
-            shutil.move("%s.%s" % (tarpath, comp), dstfile)
-
-def ziping(dstfile, target):
-    import zipfile
-    wf = zipfile.ZipFile(dstfile, 'w', compression=zipfile.ZIP_DEFLATED)
-    if os.path.isdir(target):
-        for item in os.listdir(target):
-            fpath = os.path.join(target, item)
-            if not os.path.isfile(fpath):
-                continue
-            wf.write(fpath, item, zipfile.ZIP_DEFLATED)
-    else:
-        wf.write(target, os.path.basename(target), zipfile.ZIP_DEFLATED)
-    wf.close()
-
-pack_formats = {
-    ".tar": taring,
-    ".tar.gz": taring,
-    ".tar.bz2": taring,
-    ".tgz": taring,
-    ".tbz": taring,
-    ".zip": ziping,
-}
-
-def packing(dstfile, target):
-    (base, ext) = os.path.splitext(dstfile)
-    if ext in (".gz", ".bz2") and base.endswith(".tar"):
-        ext = ".tar" + ext
-    if ext not in pack_formats:
-        raise CreatorError("Unsupport pack format: %s, valid values: %s"
-                           % (ext, ','.join(pack_formats.keys())))
-    func = pack_formats[ext]
-    # func should be callable
-    func(dstfile, target)
-
 def human_size(size):
     """Return human readable string for Bytes size
     """
@@ -371,22 +234,6 @@ def normalize_ksfile(ksconf, release, arch):
     return ksconf
 
 
-def _check_mic_chroot(rootdir):
-    def _path(path):
-        return rootdir.rstrip('/') + path
-
-    release_files = map(_path, [ "/etc/moblin-release",
-                                 "/etc/meego-release",
-                                 "/etc/tizen-release"])
-
-    if not any(map(os.path.exists, release_files)):
-        msger.warning("Dir %s is not a MeeGo/Tizen chroot env" % rootdir)
-
-    if not glob.glob(rootdir + "/boot/vmlinuz-*"):
-        msger.warning("Failed to find kernel module under %s" % rootdir)
-
-    return
-
 def selinux_check(arch, fstypes):
     try:
         getenforce = find_binary_path('getenforce')
@@ -403,64 +250,6 @@ def selinux_check(arch, fstypes):
         raise CreatorError("Can't create btrfs image if selinux is enabled,"
                            " please run 'setenforce 0' to disable selinux")
 
-def get_image_type(path):
-    def _get_extension_name(path):
-        match = re.search("(?<=\.)\w+$", path)
-        if match:
-            return match.group(0)
-        else:
-            return None
-
-    if os.path.isdir(path):
-        _check_mic_chroot(path)
-        return "fs"
-
-    maptab = {
-              "tar": "loop",
-              "raw":"raw",
-              "vmdk":"vmdk",
-              "vdi":"vdi",
-              "iso":"livecd",
-              "usbimg":"liveusb",
-             }
-
-    extension = _get_extension_name(path)
-    if extension in maptab:
-        return maptab[extension]
-
-    fd = open(path, "rb")
-    file_header = fd.read(1024)
-    fd.close()
-    vdi_flag = "<<< Sun VirtualBox Disk Image >>>"
-    if file_header[0:len(vdi_flag)] == vdi_flag:
-        return maptab["vdi"]
-
-    output = runner.outs(['file', path])
-    isoptn = re.compile(r".*ISO 9660 CD-ROM filesystem.*(bootable).*")
-    usbimgptn = re.compile(r".*x86 boot sector.*active.*")
-    rawptn = re.compile(r".*x86 boot sector.*")
-    vmdkptn = re.compile(r".*VMware. disk image.*")
-    ext3fsimgptn = re.compile(r".*Linux.*ext3 filesystem data.*")
-    ext4fsimgptn = re.compile(r".*Linux.*ext4 filesystem data.*")
-    btrfsimgptn = re.compile(r".*BTRFS.*")
-    if isoptn.match(output):
-        return maptab["iso"]
-    elif usbimgptn.match(output):
-        return maptab["usbimg"]
-    elif rawptn.match(output):
-        return maptab["raw"]
-    elif vmdkptn.match(output):
-        return maptab["vmdk"]
-    elif ext3fsimgptn.match(output):
-        return "ext3fsimg"
-    elif ext4fsimgptn.match(output):
-        return "ext4fsimg"
-    elif btrfsimgptn.match(output):
-        return "btrfsimg"
-    else:
-        raise CreatorError("Cannot detect the type of image: %s" % path)
-
-
 def get_file_size(filename):
     """ Return size in MB unit """
     cmd = ['du', "-s", "-b", "-B", "1M", filename]
@@ -482,583 +271,12 @@ def get_filesystem_avail(fs):
     vfstat = os.statvfs(fs)
     return vfstat.f_bavail * vfstat.f_bsize
 
-def convert_image(srcimg, srcfmt, dstimg, dstfmt):
-    #convert disk format
-    if dstfmt != "raw":
-        raise CreatorError("Invalid destination image format: %s" % dstfmt)
-    msger.debug("converting %s image to %s" % (srcimg, dstimg))
-    if srcfmt == "vmdk":
-        path = find_binary_path("qemu-img")
-        argv = [path, "convert", "-f", "vmdk", srcimg, "-O", dstfmt,  dstimg]
-    elif srcfmt == "vdi":
-        path = find_binary_path("VBoxManage")
-        argv = [path, "internalcommands", "converttoraw", srcimg, dstimg]
-    else:
-        raise CreatorError("Invalid soure image format: %s" % srcfmt)
-
-    rc = runner.show(argv)
-    if rc == 0:
-        msger.debug("convert successful")
-    if rc != 0:
-        raise CreatorError("Unable to convert disk to %s" % dstfmt)
-
-def uncompress_squashfs(squashfsimg, outdir):
-    """Uncompress file system from squshfs image"""
-    unsquashfs = find_binary_path("unsquashfs")
-    args = [ unsquashfs, "-d", outdir, squashfsimg ]
-    rc = runner.show(args)
-    if (rc != 0):
-        raise SquashfsError("Failed to uncompress %s." % squashfsimg)
-
 def mkdtemp(dir = "/var/tmp", prefix = "wic-tmp-"):
     """ FIXME: use the dir in wic.conf instead """
 
     makedirs(dir)
     return tempfile.mkdtemp(dir = dir, prefix = prefix)
 
-def get_repostrs_from_ks(ks):
-    def _get_temp_reponame(baseurl):
-        md5obj = hashlib.md5(baseurl)
-        tmpreponame = "%s" % md5obj.hexdigest()
-        return tmpreponame
-
-    kickstart_repos = []
-
-    for repodata in ks.handler.repo.repoList:
-        repo = {}
-        for attr in ('name',
-                     'baseurl',
-                     'mirrorlist',
-                     'includepkgs', # val is list
-                     'excludepkgs', # val is list
-                     'cost',    # int
-                     'priority',# int
-                     'save',
-                     'proxy',
-                     'proxyuser',
-                     'proxypasswd',
-                     'proxypasswd',
-                     'debuginfo',
-                     'source',
-                     'gpgkey',
-                     'ssl_verify'):
-            if hasattr(repodata, attr) and getattr(repodata, attr):
-                repo[attr] = getattr(repodata, attr)
-
-        if 'name' not in repo:
-            repo['name'] = _get_temp_reponame(repodata.baseurl)
-
-        kickstart_repos.append(repo)
-
-    return kickstart_repos
-
-def _get_uncompressed_data_from_url(url, filename, proxies):
-    filename = myurlgrab(url, filename, proxies)
-    suffix = None
-    if filename.endswith(".gz"):
-        suffix = ".gz"
-        runner.quiet(['gunzip', "-f", filename])
-    elif filename.endswith(".bz2"):
-        suffix = ".bz2"
-        runner.quiet(['bunzip2', "-f", filename])
-    if suffix:
-        filename = filename.replace(suffix, "")
-    return filename
-
-def _get_metadata_from_repo(baseurl, proxies, cachedir, reponame, filename,
-                            sumtype=None, checksum=None):
-    url = os.path.join(baseurl, filename)
-    filename_tmp = str("%s/%s/%s" % (cachedir, reponame, os.path.basename(filename)))
-    if os.path.splitext(filename_tmp)[1] in (".gz", ".bz2"):
-        filename = os.path.splitext(filename_tmp)[0]
-    else:
-        filename = filename_tmp
-    if sumtype and checksum and os.path.exists(filename):
-        try:
-            sumcmd = find_binary_path("%ssum" % sumtype)
-        except:
-            file_checksum = None
-        else:
-            file_checksum = runner.outs([sumcmd, filename]).split()[0]
-
-        if file_checksum and file_checksum == checksum:
-            return filename
-
-    return _get_uncompressed_data_from_url(url,filename_tmp,proxies)
-
-def get_metadata_from_repos(repos, cachedir):
-    my_repo_metadata = []
-    for repo in repos:
-        reponame = repo['name']
-        baseurl  = repo['baseurl']
-
-
-        if 'proxy' in repo:
-            proxy = repo['proxy']
-        else:
-            proxy = get_proxy_for(baseurl)
-
-        proxies = None
-        if proxy:
-            proxies = {str(baseurl.split(":")[0]):str(proxy)}
-
-        makedirs(os.path.join(cachedir, reponame))
-        url = os.path.join(baseurl, "repodata/repomd.xml")
-        filename = os.path.join(cachedir, reponame, 'repomd.xml')
-        repomd = myurlgrab(url, filename, proxies)
-        try:
-            root = xmlparse(repomd)
-        except SyntaxError:
-            raise CreatorError("repomd.xml syntax error.")
-
-        ns = root.getroot().tag
-        ns = ns[0:ns.rindex("}")+1]
-
-        filepaths = {}
-        checksums = {}
-        sumtypes = {}
-
-        for elm in root.getiterator("%sdata" % ns):
-            if elm.attrib["type"] == "patterns":
-                filepaths['patterns'] = elm.find("%slocation" % ns).attrib['href']
-                checksums['patterns'] = elm.find("%sopen-checksum" % ns).text
-                sumtypes['patterns'] = elm.find("%sopen-checksum" % ns).attrib['type']
-                break
-
-        for elm in root.getiterator("%sdata" % ns):
-            if elm.attrib["type"] in ("group_gz", "group"):
-                filepaths['comps'] = elm.find("%slocation" % ns).attrib['href']
-                checksums['comps'] = elm.find("%sopen-checksum" % ns).text
-                sumtypes['comps'] = elm.find("%sopen-checksum" % ns).attrib['type']
-                break
-
-        primary_type = None
-        for elm in root.getiterator("%sdata" % ns):
-            if elm.attrib["type"] in ("primary_db", "primary"):
-                primary_type = elm.attrib["type"]
-                filepaths['primary'] = elm.find("%slocation" % ns).attrib['href']
-                checksums['primary'] = elm.find("%sopen-checksum" % ns).text
-                sumtypes['primary'] = elm.find("%sopen-checksum" % ns).attrib['type']
-                break
-
-        if not primary_type:
-            continue
-
-        for item in ("primary", "patterns", "comps"):
-            if item not in filepaths:
-                filepaths[item] = None
-                continue
-            if not filepaths[item]:
-                continue
-            filepaths[item] = _get_metadata_from_repo(baseurl,
-                                                      proxies,
-                                                      cachedir,
-                                                      reponame,
-                                                      filepaths[item],
-                                                      sumtypes[item],
-                                                      checksums[item])
-
-        """ Get repo key """
-        try:
-            repokey = _get_metadata_from_repo(baseurl,
-                                              proxies,
-                                              cachedir,
-                                              reponame,
-                                              "repodata/repomd.xml.key")
-        except CreatorError:
-            repokey = None
-            msger.debug("\ncan't get %s/%s" % (baseurl, "repodata/repomd.xml.key"))
-
-        my_repo_metadata.append({"name":reponame,
-                                 "baseurl":baseurl,
-                                 "repomd":repomd,
-                                 "primary":filepaths['primary'],
-                                 "cachedir":cachedir,
-                                 "proxies":proxies,
-                                 "patterns":filepaths['patterns'],
-                                 "comps":filepaths['comps'],
-                                 "repokey":repokey})
-
-    return my_repo_metadata
-
-def get_rpmver_in_repo(repometadata):
-    for repo in repometadata:
-        if repo["primary"].endswith(".xml"):
-            root = xmlparse(repo["primary"])
-            ns = root.getroot().tag
-            ns = ns[0:ns.rindex("}")+1]
-
-            versionlist = []
-            for elm in root.getiterator("%spackage" % ns):
-                if elm.find("%sname" % ns).text == 'rpm':
-                    for node in elm.getchildren():
-                        if node.tag == "%sversion" % ns:
-                            versionlist.append(node.attrib['ver'])
-
-            if versionlist:
-                return reversed(
-                         sorted(
-                           versionlist,
-                           key = lambda ver: map(int, ver.split('.')))).next()
-
-        elif repo["primary"].endswith(".sqlite"):
-            con = sqlite.connect(repo["primary"])
-            for row in con.execute("select version from packages where "
-                                   "name=\"rpm\" ORDER by version DESC"):
-                con.close()
-                return row[0]
-
-    return None
-
-def get_arch(repometadata):
-    archlist = []
-    for repo in repometadata:
-        if repo["primary"].endswith(".xml"):
-            root = xmlparse(repo["primary"])
-            ns = root.getroot().tag
-            ns = ns[0:ns.rindex("}")+1]
-            for elm in root.getiterator("%spackage" % ns):
-                if elm.find("%sarch" % ns).text not in ("noarch", "src"):
-                    arch = elm.find("%sarch" % ns).text
-                    if arch not in archlist:
-                        archlist.append(arch)
-        elif repo["primary"].endswith(".sqlite"):
-            con = sqlite.connect(repo["primary"])
-            for row in con.execute("select arch from packages where arch not in (\"src\", \"noarch\")"):
-                if row[0] not in archlist:
-                    archlist.append(row[0])
-
-            con.close()
-
-    uniq_arch = []
-    for i in range(len(archlist)):
-        if archlist[i] not in rpmmisc.archPolicies.keys():
-            continue
-        need_append = True
-        j = 0
-        while j < len(uniq_arch):
-            if archlist[i] in rpmmisc.archPolicies[uniq_arch[j]].split(':'):
-                need_append = False
-                break
-            if uniq_arch[j] in rpmmisc.archPolicies[archlist[i]].split(':'):
-                if need_append:
-                    uniq_arch[j] = archlist[i]
-                    need_append = False
-                else:
-                    uniq_arch.remove(uniq_arch[j])
-                    continue
-            j += 1
-        if need_append:
-             uniq_arch.append(archlist[i])
-
-    return uniq_arch, archlist
-
-def get_package(pkg, repometadata, arch = None):
-    ver = ""
-    target_repo = None
-    if not arch:
-        arches = []
-    elif arch not in rpmmisc.archPolicies:
-        arches = [arch]
-    else:
-        arches = rpmmisc.archPolicies[arch].split(':')
-        arches.append('noarch')
-
-    for repo in repometadata:
-        if repo["primary"].endswith(".xml"):
-            root = xmlparse(repo["primary"])
-            ns = root.getroot().tag
-            ns = ns[0:ns.rindex("}")+1]
-            for elm in root.getiterator("%spackage" % ns):
-                if elm.find("%sname" % ns).text == pkg:
-                    if elm.find("%sarch" % ns).text in arches:
-                        version = elm.find("%sversion" % ns)
-                        tmpver = "%s-%s" % (version.attrib['ver'], version.attrib['rel'])
-                        if tmpver > ver:
-                            ver = tmpver
-                            location = elm.find("%slocation" % ns)
-                            pkgpath = "%s" % location.attrib['href']
-                            target_repo = repo
-                        break
-        if repo["primary"].endswith(".sqlite"):
-            con = sqlite.connect(repo["primary"])
-            if arch:
-                sql = 'select version, release, location_href from packages ' \
-                      'where name = "%s" and arch IN ("%s")' % \
-                      (pkg, '","'.join(arches))
-                for row in con.execute(sql):
-                    tmpver = "%s-%s" % (row[0], row[1])
-                    if tmpver > ver:
-                        ver = tmpver
-                        pkgpath = "%s" % row[2]
-                        target_repo = repo
-                    break
-            else:
-                sql = 'select version, release, location_href from packages ' \
-                      'where name = "%s"' % pkg
-                for row in con.execute(sql):
-                    tmpver = "%s-%s" % (row[0], row[1])
-                    if tmpver > ver:
-                        ver = tmpver
-                        pkgpath = "%s" % row[2]
-                        target_repo = repo
-                    break
-            con.close()
-    if target_repo:
-        makedirs("%s/packages/%s" % (target_repo["cachedir"], target_repo["name"]))
-        url = os.path.join(target_repo["baseurl"], pkgpath)
-        filename = str("%s/packages/%s/%s" % (target_repo["cachedir"], target_repo["name"], os.path.basename(pkgpath)))
-        if os.path.exists(filename):
-            ret = rpmmisc.checkRpmIntegrity('rpm', filename)
-            if ret == 0:
-                return filename
-
-            msger.warning("package %s is damaged: %s" %
-                          (os.path.basename(filename), filename))
-            os.unlink(filename)
-
-        pkg = myurlgrab(str(url), filename, target_repo["proxies"])
-        return pkg
-    else:
-        return None
-
-def get_source_name(pkg, repometadata):
-
-    def get_bin_name(pkg):
-        m = RPM_RE.match(pkg)
-        if m:
-            return m.group(1)
-        return None
-
-    def get_src_name(srpm):
-        m = SRPM_RE.match(srpm)
-        if m:
-            return m.group(1)
-        return None
-
-    ver = ""
-    target_repo = None
-
-    pkg_name = get_bin_name(pkg)
-    if not pkg_name:
-        return None
-
-    for repo in repometadata:
-        if repo["primary"].endswith(".xml"):
-            root = xmlparse(repo["primary"])
-            ns = root.getroot().tag
-            ns = ns[0:ns.rindex("}")+1]
-            for elm in root.getiterator("%spackage" % ns):
-                if elm.find("%sname" % ns).text == pkg_name:
-                    if elm.find("%sarch" % ns).text != "src":
-                        version = elm.find("%sversion" % ns)
-                        tmpver = "%s-%s" % (version.attrib['ver'], version.attrib['rel'])
-                        if tmpver > ver:
-                            ver = tmpver
-                            fmt = elm.find("%sformat" % ns)
-                            if fmt:
-                                fns = fmt.getchildren()[0].tag
-                                fns = fns[0:fns.rindex("}")+1]
-                                pkgpath = fmt.find("%ssourcerpm" % fns).text
-                                target_repo = repo
-                        break
-
-        if repo["primary"].endswith(".sqlite"):
-            con = sqlite.connect(repo["primary"])
-            for row in con.execute("select version, release, rpm_sourcerpm from packages where name = \"%s\" and arch != \"src\"" % pkg_name):
-                tmpver = "%s-%s" % (row[0], row[1])
-                if tmpver > ver:
-                    pkgpath = "%s" % row[2]
-                    target_repo = repo
-                break
-            con.close()
-    if target_repo:
-        return get_src_name(pkgpath)
-    else:
-        return None
-
-def get_pkglist_in_patterns(group, patterns):
-    found = False
-    pkglist = []
-    try:
-        root = xmlparse(patterns)
-    except SyntaxError:
-        raise SyntaxError("%s syntax error." % patterns)
-
-    for elm in list(root.getroot()):
-        ns = elm.tag
-        ns = ns[0:ns.rindex("}")+1]
-        name = elm.find("%sname" % ns)
-        summary = elm.find("%ssummary" % ns)
-        if name.text == group or summary.text == group:
-            found = True
-            break
-
-    if not found:
-        return pkglist
-
-    found = False
-    for requires in list(elm):
-        if requires.tag.endswith("requires"):
-            found = True
-            break
-
-    if not found:
-        return pkglist
-
-    for pkg in list(requires):
-        pkgname = pkg.attrib["name"]
-        if pkgname not in pkglist:
-            pkglist.append(pkgname)
-
-    return pkglist
-
-def get_pkglist_in_comps(group, comps):
-    found = False
-    pkglist = []
-    try:
-        root = xmlparse(comps)
-    except SyntaxError:
-        raise SyntaxError("%s syntax error." % comps)
-
-    for elm in root.getiterator("group"):
-        id = elm.find("id")
-        name = elm.find("name")
-        if id.text == group or name.text == group:
-            packagelist = elm.find("packagelist")
-            found = True
-            break
-
-    if not found:
-        return pkglist
-
-    for require in elm.getiterator("packagereq"):
-        if require.tag.endswith("packagereq"):
-            pkgname = require.text
-        if pkgname not in pkglist:
-            pkglist.append(pkgname)
-
-    return pkglist
-
-def is_statically_linked(binary):
-    return ", statically linked, " in runner.outs(['file', binary])
-
-def setup_qemu_emulator(rootdir, arch):
-    # mount binfmt_misc if it doesn't exist
-    if not os.path.exists("/proc/sys/fs/binfmt_misc"):
-        modprobecmd = find_binary_path("modprobe")
-        runner.show([modprobecmd, "binfmt_misc"])
-    if not os.path.exists("/proc/sys/fs/binfmt_misc/register"):
-        mountcmd = find_binary_path("mount")
-        runner.show([mountcmd, "-t", "binfmt_misc", "none", "/proc/sys/fs/binfmt_misc"])
-
-    # qemu_emulator is a special case, we can't use find_binary_path
-    # qemu emulator should be a statically-linked executable file
-    qemu_emulator = "/usr/bin/qemu-arm"
-    if not os.path.exists(qemu_emulator) or not is_statically_linked(qemu_emulator):
-        qemu_emulator = "/usr/bin/qemu-arm-static"
-    if not os.path.exists(qemu_emulator):
-        raise CreatorError("Please install a statically-linked qemu-arm")
-
-    # qemu emulator version check
-    armv7_list = [arch for arch in rpmmisc.archPolicies.keys() if arch.startswith('armv7')]
-    if arch in armv7_list:  # need qemu (>=0.13.0)
-        qemuout = runner.outs([qemu_emulator, "-h"])
-        m = re.search("version\s*([.\d]+)", qemuout)
-        if m:
-            qemu_version = m.group(1)
-            if qemu_version < "0.13":
-                raise CreatorError("Requires %s version >=0.13 for %s" % (qemu_emulator, arch))
-        else:
-            msger.warning("Can't get version info of %s, please make sure it's higher than 0.13.0" % qemu_emulator)
-
-    if not os.path.exists(rootdir + "/usr/bin"):
-        makedirs(rootdir + "/usr/bin")
-    shutil.copy(qemu_emulator, rootdir + "/usr/bin/qemu-arm-static")
-    qemu_emulator = "/usr/bin/qemu-arm-static"
-
-    # disable selinux, selinux will block qemu emulator to run
-    if os.path.exists("/usr/sbin/setenforce"):
-        msger.info('Try to disable selinux')
-        runner.show(["/usr/sbin/setenforce", "0"])
-
-    # unregister it if it has been registered and is a dynamically-linked executable
-    node = "/proc/sys/fs/binfmt_misc/arm"
-    if os.path.exists(node):
-        qemu_unregister_string = "-1\n"
-        fd = open("/proc/sys/fs/binfmt_misc/arm", "w")
-        fd.write(qemu_unregister_string)
-        fd.close()
-
-    # register qemu emulator for interpreting other arch executable file
-    if not os.path.exists(node):
-        qemu_arm_string = ":arm:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfa\\xff\\xff\\xff:%s:\n" % qemu_emulator
-        fd = open("/proc/sys/fs/binfmt_misc/register", "w")
-        fd.write(qemu_arm_string)
-        fd.close()
-
-    return qemu_emulator
-
-def SrcpkgsDownload(pkgs, repometadata, instroot, cachedir):
-    def get_source_repometadata(repometadata):
-        src_repometadata=[]
-        for repo in repometadata:
-            if repo["name"].endswith("-source"):
-                src_repometadata.append(repo)
-        if src_repometadata:
-            return src_repometadata
-        return None
-
-    def get_src_name(srpm):
-        m = SRPM_RE.match(srpm)
-        if m:
-            return m.group(1)
-        return None
-
-    src_repometadata = get_source_repometadata(repometadata)
-
-    if not src_repometadata:
-        msger.warning("No source repo found")
-        return None
-
-    src_pkgs = []
-    lpkgs_dict = {}
-    lpkgs_path = []
-    for repo in src_repometadata:
-        cachepath = "%s/%s/packages/*.src.rpm" %(cachedir, repo["name"])
-        lpkgs_path += glob.glob(cachepath)
-
-    for lpkg in lpkgs_path:
-        lpkg_name = get_src_name(os.path.basename(lpkg))
-        lpkgs_dict[lpkg_name] = lpkg
-    localpkgs = lpkgs_dict.keys()
-
-    cached_count = 0
-    destdir = instroot+'/usr/src/SRPMS'
-    if not os.path.exists(destdir):
-        os.makedirs(destdir)
-
-    srcpkgset = set()
-    for _pkg in pkgs:
-        srcpkg_name = get_source_name(_pkg, repometadata)
-        if not srcpkg_name:
-            continue
-        srcpkgset.add(srcpkg_name)
-
-    for pkg in list(srcpkgset):
-        if pkg in localpkgs:
-            cached_count += 1
-            shutil.copy(lpkgs_dict[pkg], destdir)
-            src_pkgs.append(os.path.basename(lpkgs_dict[pkg]))
-        else:
-            src_pkg = get_package(pkg, src_repometadata, 'src')
-            if src_pkg:
-                shutil.copy(src_pkg, destdir)
-                src_pkgs.append(src_pkg)
-    msger.info("%d source packages gotten from cache" % cached_count)
-
-    return src_pkgs
-
 def strip_end(text, suffix):
     if not text.endswith(suffix):
         return text
diff --git a/scripts/lib/mic/utils/proxy.py b/scripts/lib/mic/utils/proxy.py
deleted file mode 100644
index 91451a2..0000000
--- a/scripts/lib/mic/utils/proxy.py
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2010, 2011 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import os
-import urlparse
-
-_my_proxies = {}
-_my_noproxy = None
-_my_noproxy_list = []
-
-def set_proxy_environ():
-    global _my_noproxy, _my_proxies
-    if not _my_proxies:
-        return
-    for key in _my_proxies.keys():
-        os.environ[key + "_proxy"] = _my_proxies[key]
-    if not _my_noproxy:
-        return
-    os.environ["no_proxy"] = _my_noproxy
-
-def unset_proxy_environ():
-    for env in ('http_proxy',
-                'https_proxy',
-                'ftp_proxy',
-                'all_proxy'):
-        if env in os.environ:
-            del os.environ[env]
-
-        ENV=env.upper()
-        if ENV in os.environ:
-            del os.environ[ENV]
-
-def _set_proxies(proxy = None, no_proxy = None):
-    """Return a dictionary of scheme -> proxy server URL mappings.
-    """
-
-    global _my_noproxy, _my_proxies
-    _my_proxies = {}
-    _my_noproxy = None
-    proxies = []
-    if proxy:
-        proxies.append(("http_proxy", proxy))
-    if no_proxy:
-        proxies.append(("no_proxy", no_proxy))
-
-    # Get proxy settings from environment if not provided
-    if not proxy and not no_proxy:
-        proxies = os.environ.items()
-
-        # Remove proxy env variables, urllib2 can't handle them correctly
-        unset_proxy_environ()
-
-    for name, value in proxies:
-        name = name.lower()
-        if value and name[-6:] == '_proxy':
-            if name[0:2] != "no":
-                _my_proxies[name[:-6]] = value
-            else:
-                _my_noproxy = value
-
-def _ip_to_int(ip):
-    ipint=0
-    shift=24
-    for dec in ip.split("."):
-        ipint |= int(dec) << shift
-        shift -= 8
-    return ipint
-
-def _int_to_ip(val):
-    ipaddr=""
-    shift=0
-    for i in range(4):
-        dec = val >> shift
-        dec &= 0xff
-        ipaddr = ".%d%s" % (dec, ipaddr)
-        shift += 8
-    return ipaddr[1:]
-
-def _isip(host):
-    if host.replace(".", "").isdigit():
-        return True
-    return False
-
-def _set_noproxy_list():
-    global _my_noproxy, _my_noproxy_list
-    _my_noproxy_list = []
-    if not _my_noproxy:
-        return
-    for item in _my_noproxy.split(","):
-        item = item.strip()
-        if not item:
-            continue
-
-        if item[0] != '.' and item.find("/") == -1:
-            # Need to match it
-            _my_noproxy_list.append({"match":0,"needle":item})
-
-        elif item[0] == '.':
-            # Need to match at tail
-            _my_noproxy_list.append({"match":1,"needle":item})
-
-        elif item.find("/") > 3:
-            # IP/MASK, need to match at head
-            needle = item[0:item.find("/")].strip()
-            ip = _ip_to_int(needle)
-            netmask = 0
-            mask = item[item.find("/")+1:].strip()
-
-            if mask.isdigit():
-                netmask = int(mask)
-                netmask = ~((1<<(32-netmask)) - 1)
-                ip &= netmask
-            else:
-                shift=24
-                netmask=0
-                for dec in mask.split("."):
-                    netmask |= int(dec) << shift
-                    shift -= 8
-                ip &= netmask
-
-            _my_noproxy_list.append({"match":2,"needle":ip,"netmask":netmask})
-
-def _isnoproxy(url):
-    (scheme, host, path, parm, query, frag) = urlparse.urlparse(url)
-
-    if '@' in host:
-        user_pass, host = host.split('@', 1)
-
-    if ':' in host:
-        host, port = host.split(':', 1)
-
-    hostisip = _isip(host)
-    for item in _my_noproxy_list:
-        if hostisip and item["match"] <= 1:
-            continue
-
-        if item["match"] == 2 and hostisip:
-            if (_ip_to_int(host) & item["netmask"]) == item["needle"]:
-                return True
-
-        if item["match"] == 0:
-            if host == item["needle"]:
-                return True
-
-        if item["match"] == 1:
-            if host.rfind(item["needle"]) > 0:
-                return True
-
-    return False
-
-def set_proxies(proxy = None, no_proxy = None):
-    _set_proxies(proxy, no_proxy)
-    _set_noproxy_list()
-    set_proxy_environ()
-
-def get_proxy_for(url):
-    if url.startswith('file:') or _isnoproxy(url):
-        return None
-
-    type = url[0:url.index(":")]
-    proxy = None
-    if _my_proxies.has_key(type):
-        proxy = _my_proxies[type]
-    elif _my_proxies.has_key("http"):
-        proxy = _my_proxies["http"]
-    else:
-        proxy = None
-
-    return proxy
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 12/35] wic: Remove rpmmisc
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (10 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 11/35] wic: Remove proxy support Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 13/35] wic: Remove unused fs_related code Tom Zanussi
                   ` (22 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use it, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/rpmmisc.py | 600 ---------------------------------------
 1 file changed, 600 deletions(-)
 delete mode 100644 scripts/lib/mic/utils/rpmmisc.py

diff --git a/scripts/lib/mic/utils/rpmmisc.py b/scripts/lib/mic/utils/rpmmisc.py
deleted file mode 100644
index af15763..0000000
--- a/scripts/lib/mic/utils/rpmmisc.py
+++ /dev/null
@@ -1,600 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2008, 2009, 2010, 2011 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import os
-import sys
-import re
-import rpm
-
-from mic import msger
-from mic.utils.errors import CreatorError
-from mic.utils.proxy import get_proxy_for
-from mic.utils import runner
-
-
-class RPMInstallCallback:
-    """ Command line callback class for callbacks from the RPM library.
-    """
-
-    def __init__(self, ts, output=1):
-        self.output = output
-        self.callbackfilehandles = {}
-        self.total_actions = 0
-        self.total_installed = 0
-        self.installed_pkg_names = []
-        self.total_removed = 0
-        self.mark = "+"
-        self.marks = 40
-        self.lastmsg = None
-        self.tsInfo = None # this needs to be set for anything else to work
-        self.ts = ts
-        self.filelog = False
-        self.logString = []
-        self.headmsg = "Installing"
-
-    def _dopkgtup(self, hdr):
-        tmpepoch = hdr['epoch']
-        if tmpepoch is None: epoch = '0'
-        else: epoch = str(tmpepoch)
-
-        return (hdr['name'], hdr['arch'], epoch, hdr['version'], hdr['release'])
-
-    def _makeHandle(self, hdr):
-        handle = '%s:%s.%s-%s-%s' % (hdr['epoch'], hdr['name'], hdr['version'],
-          hdr['release'], hdr['arch'])
-
-        return handle
-
-    def _localprint(self, msg):
-        if self.output:
-            msger.info(msg)
-
-    def _makefmt(self, percent, progress = True):
-        l = len(str(self.total_actions))
-        size = "%s.%s" % (l, l)
-        fmt_done = "[%" + size + "s/%" + size + "s]"
-        done = fmt_done % (self.total_installed + self.total_removed,
-                           self.total_actions)
-        marks = self.marks - (2 * l)
-        width = "%s.%s" % (marks, marks)
-        fmt_bar = "%-" + width + "s"
-        if progress:
-            bar = fmt_bar % (self.mark * int(marks * (percent / 100.0)), )
-            fmt = "\r  %-10.10s: %-20.20s " + bar + " " + done
-        else:
-            bar = fmt_bar % (self.mark * marks, )
-            fmt = "  %-10.10s: %-20.20s "  + bar + " " + done
-        return fmt
-
-    def _logPkgString(self, hdr):
-        """return nice representation of the package for the log"""
-        (n,a,e,v,r) = self._dopkgtup(hdr)
-        if e == '0':
-            pkg = '%s.%s %s-%s' % (n, a, v, r)
-        else:
-            pkg = '%s.%s %s:%s-%s' % (n, a, e, v, r)
-
-        return pkg
-
-    def callback(self, what, bytes, total, h, user):
-        if what == rpm.RPMCALLBACK_TRANS_START:
-            if bytes == 6:
-                self.total_actions = total
-
-        elif what == rpm.RPMCALLBACK_TRANS_PROGRESS:
-            pass
-
-        elif what == rpm.RPMCALLBACK_TRANS_STOP:
-            pass
-
-        elif what == rpm.RPMCALLBACK_INST_OPEN_FILE:
-            self.lastmsg = None
-            hdr = None
-            if h is not None:
-                try:
-                    hdr, rpmloc = h
-                except:
-                    rpmloc = h
-                    hdr = readRpmHeader(self.ts, h)
-
-                handle = self._makeHandle(hdr)
-                fd = os.open(rpmloc, os.O_RDONLY)
-                self.callbackfilehandles[handle]=fd
-                if hdr['name'] not in self.installed_pkg_names:
-                    self.installed_pkg_names.append(hdr['name'])
-                    self.total_installed += 1
-                return fd
-            else:
-                self._localprint("No header - huh?")
-
-        elif what == rpm.RPMCALLBACK_INST_CLOSE_FILE:
-            hdr = None
-            if h is not None:
-                try:
-                    hdr, rpmloc = h
-                except:
-                    rpmloc = h
-                    hdr = readRpmHeader(self.ts, h)
-
-                handle = self._makeHandle(hdr)
-                os.close(self.callbackfilehandles[handle])
-                fd = 0
-
-                # log stuff
-                #pkgtup = self._dopkgtup(hdr)
-                self.logString.append(self._logPkgString(hdr))
-
-        elif what == rpm.RPMCALLBACK_INST_PROGRESS:
-            if h is not None:
-                percent = (self.total_installed*100L)/self.total_actions
-                if total > 0:
-                    try:
-                        hdr, rpmloc = h
-                    except:
-                        rpmloc = h
-
-                    m = re.match("(.*)-(\d+.*)-(\d+\.\d+)\.(.+)\.rpm", os.path.basename(rpmloc))
-                    if m:
-                        pkgname = m.group(1)
-                    else:
-                        pkgname = os.path.basename(rpmloc)
-                if self.output:
-                    fmt = self._makefmt(percent)
-                    msg = fmt % (self.headmsg, pkgname)
-                    if msg != self.lastmsg:
-                        self.lastmsg = msg
-
-                        msger.info(msg)
-
-                        if self.total_installed == self.total_actions:
-                            msger.raw('')
-                            msger.verbose('\n'.join(self.logString))
-
-        elif what == rpm.RPMCALLBACK_UNINST_START:
-            pass
-
-        elif what == rpm.RPMCALLBACK_UNINST_PROGRESS:
-            pass
-
-        elif what == rpm.RPMCALLBACK_UNINST_STOP:
-            self.total_removed += 1
-
-        elif what == rpm.RPMCALLBACK_REPACKAGE_START:
-            pass
-
-        elif what == rpm.RPMCALLBACK_REPACKAGE_STOP:
-            pass
-
-        elif what == rpm.RPMCALLBACK_REPACKAGE_PROGRESS:
-            pass
-
-def readRpmHeader(ts, filename):
-    """ Read an rpm header. """
-
-    fd = os.open(filename, os.O_RDONLY)
-    h = ts.hdrFromFdno(fd)
-    os.close(fd)
-    return h
-
-def splitFilename(filename):
-    """ Pass in a standard style rpm fullname
-
-        Return a name, version, release, epoch, arch, e.g.::
-            foo-1.0-1.i386.rpm returns foo, 1.0, 1, i386
-            1:bar-9-123a.ia64.rpm returns bar, 9, 123a, 1, ia64
-    """
-
-    if filename[-4:] == '.rpm':
-        filename = filename[:-4]
-
-    archIndex = filename.rfind('.')
-    arch = filename[archIndex+1:]
-
-    relIndex = filename[:archIndex].rfind('-')
-    rel = filename[relIndex+1:archIndex]
-
-    verIndex = filename[:relIndex].rfind('-')
-    ver = filename[verIndex+1:relIndex]
-
-    epochIndex = filename.find(':')
-    if epochIndex == -1:
-        epoch = ''
-    else:
-        epoch = filename[:epochIndex]
-
-    name = filename[epochIndex + 1:verIndex]
-    return name, ver, rel, epoch, arch
-
-def getCanonX86Arch(arch):
-    #
-    if arch == "i586":
-        f = open("/proc/cpuinfo", "r")
-        lines = f.readlines()
-        f.close()
-        for line in lines:
-            if line.startswith("model name") and line.find("Geode(TM)") != -1:
-                return "geode"
-        return arch
-    # only athlon vs i686 isn't handled with uname currently
-    if arch != "i686":
-        return arch
-
-    # if we're i686 and AuthenticAMD, then we should be an athlon
-    f = open("/proc/cpuinfo", "r")
-    lines = f.readlines()
-    f.close()
-    for line in lines:
-        if line.startswith("vendor") and line.find("AuthenticAMD") != -1:
-            return "athlon"
-        # i686 doesn't guarantee cmov, but we depend on it
-        elif line.startswith("flags") and line.find("cmov") == -1:
-            return "i586"
-
-    return arch
-
-def getCanonX86_64Arch(arch):
-    if arch != "x86_64":
-        return arch
-
-    vendor = None
-    f = open("/proc/cpuinfo", "r")
-    lines = f.readlines()
-    f.close()
-    for line in lines:
-        if line.startswith("vendor_id"):
-            vendor = line.split(':')[1]
-            break
-    if vendor is None:
-        return arch
-
-    if vendor.find("Authentic AMD") != -1 or vendor.find("AuthenticAMD") != -1:
-        return "amd64"
-    if vendor.find("GenuineIntel") != -1:
-        return "ia32e"
-    return arch
-
-def getCanonArch():
-    arch = os.uname()[4]
-
-    if (len(arch) == 4 and arch[0] == "i" and arch[2:4] == "86"):
-        return getCanonX86Arch(arch)
-
-    if arch == "x86_64":
-        return getCanonX86_64Arch(arch)
-
-    return arch
-
-# Copy from libsatsolver:poolarch.c, with cleanup
-archPolicies = {
-    "x86_64":       "x86_64:i686:i586:i486:i386",
-    "i686":         "i686:i586:i486:i386",
-    "i586":         "i586:i486:i386",
-    "ia64":         "ia64:i686:i586:i486:i386",
-    "armv7tnhl":    "armv7tnhl:armv7thl:armv7nhl:armv7hl",
-    "armv7thl":     "armv7thl:armv7hl",
-    "armv7nhl":     "armv7nhl:armv7hl",
-    "armv7hl":      "armv7hl",
-    "armv7l":       "armv7l:armv6l:armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
-    "armv6l":       "armv6l:armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
-    "armv5tejl":    "armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
-    "armv5tel":     "armv5tel:armv5l:armv4tl:armv4l:armv3l",
-    "armv5l":       "armv5l:armv4tl:armv4l:armv3l",
-}
-
-# dict mapping arch -> ( multicompat, best personality, biarch personality )
-multilibArches = {
-    "x86_64":  ( "athlon", "x86_64", "athlon" ),
-}
-
-# from yumUtils.py
-arches = {
-    # ia32
-    "athlon": "i686",
-    "i686": "i586",
-    "geode": "i586",
-    "i586": "i486",
-    "i486": "i386",
-    "i386": "noarch",
-
-    # amd64
-    "x86_64": "athlon",
-    "amd64": "x86_64",
-    "ia32e": "x86_64",
-
-    # arm
-    "armv7tnhl": "armv7nhl",
-    "armv7nhl": "armv7hl",
-    "armv7hl": "noarch",
-    "armv7l": "armv6l",
-    "armv6l": "armv5tejl",
-    "armv5tejl": "armv5tel",
-    "armv5tel": "noarch",
-
-    #itanium
-    "ia64": "noarch",
-}
-
-def isMultiLibArch(arch=None):
-    """returns true if arch is a multilib arch, false if not"""
-    if arch is None:
-        arch = getCanonArch()
-
-    if not arches.has_key(arch): # or we could check if it is noarch
-        return False
-
-    if multilibArches.has_key(arch):
-        return True
-
-    if multilibArches.has_key(arches[arch]):
-        return True
-
-    return False
-
-def getBaseArch():
-    myarch = getCanonArch()
-    if not arches.has_key(myarch):
-        return myarch
-
-    if isMultiLibArch(arch=myarch):
-        if multilibArches.has_key(myarch):
-            return myarch
-        else:
-            return arches[myarch]
-
-    if arches.has_key(myarch):
-        basearch = myarch
-        value = arches[basearch]
-        while value != 'noarch':
-            basearch = value
-            value = arches[basearch]
-
-        return basearch
-
-def checkRpmIntegrity(bin_rpm, package):
-    return runner.quiet([bin_rpm, "-K", "--nosignature", package])
-
-def checkSig(ts, package):
-    """ Takes a transaction set and a package, check it's sigs,
-        return 0 if they are all fine
-        return 1 if the gpg key can't be found
-        return 2 if the header is in someway damaged
-        return 3 if the key is not trusted
-        return 4 if the pkg is not gpg or pgp signed
-    """
-
-    value = 0
-    currentflags = ts.setVSFlags(0)
-    fdno = os.open(package, os.O_RDONLY)
-    try:
-        hdr = ts.hdrFromFdno(fdno)
-
-    except rpm.error, e:
-        if str(e) == "public key not availaiable":
-            value = 1
-        if str(e) == "public key not available":
-            value = 1
-        if str(e) == "public key not trusted":
-            value = 3
-        if str(e) == "error reading package header":
-            value = 2
-    else:
-        error, siginfo = getSigInfo(hdr)
-        if error == 101:
-            os.close(fdno)
-            del hdr
-            value = 4
-        else:
-            del hdr
-
-    try:
-        os.close(fdno)
-    except OSError:
-        pass
-
-    ts.setVSFlags(currentflags) # put things back like they were before
-    return value
-
-def getSigInfo(hdr):
-    """ checks signature from an hdr hand back signature information and/or
-        an error code
-    """
-
-    import locale
-    locale.setlocale(locale.LC_ALL, 'C')
-
-    string = '%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|'
-    siginfo = hdr.sprintf(string)
-    if siginfo != '(none)':
-        error = 0
-        sigtype, sigdate, sigid = siginfo.split(',')
-    else:
-        error = 101
-        sigtype = 'MD5'
-        sigdate = 'None'
-        sigid = 'None'
-
-    infotuple = (sigtype, sigdate, sigid)
-    return error, infotuple
-
-def checkRepositoryEULA(name, repo):
-    """ This function is to check the EULA file if provided.
-        return True: no EULA or accepted
-        return False: user declined the EULA
-    """
-
-    import tempfile
-    import shutil
-    import urlparse
-    import urllib2 as u2
-    import httplib
-    from mic.utils.errors import CreatorError
-
-    def _check_and_download_url(u2opener, url, savepath):
-        try:
-            if u2opener:
-                f = u2opener.open(url)
-            else:
-                f = u2.urlopen(url)
-        except u2.HTTPError, httperror:
-            if httperror.code in (404, 503):
-                return None
-            else:
-                raise CreatorError(httperror)
-        except OSError, oserr:
-            if oserr.errno == 2:
-                return None
-            else:
-                raise CreatorError(oserr)
-        except IOError, oserr:
-            if hasattr(oserr, "reason") and oserr.reason.errno == 2:
-                return None
-            else:
-                raise CreatorError(oserr)
-        except u2.URLError, err:
-            raise CreatorError(err)
-        except httplib.HTTPException, e:
-            raise CreatorError(e)
-
-        # save to file
-        licf = open(savepath, "w")
-        licf.write(f.read())
-        licf.close()
-        f.close()
-
-        return savepath
-
-    def _pager_file(savepath):
-
-        if os.path.splitext(savepath)[1].upper() in ('.HTM', '.HTML'):
-            pagers = ('w3m', 'links', 'lynx', 'less', 'more')
-        else:
-            pagers = ('less', 'more')
-
-        file_showed = False
-        for pager in pagers:
-            cmd = "%s %s" % (pager, savepath)
-            try:
-                os.system(cmd)
-            except OSError:
-                continue
-            else:
-                file_showed = True
-                break
-
-        if not file_showed:
-            f = open(savepath)
-            msger.raw(f.read())
-            f.close()
-            msger.pause()
-
-    # when proxy needed, make urllib2 follow it
-    proxy = repo.proxy
-    proxy_username = repo.proxy_username
-    proxy_password = repo.proxy_password
-
-    if not proxy:
-        proxy = get_proxy_for(repo.baseurl[0])
-
-    handlers = []
-    auth_handler = u2.HTTPBasicAuthHandler(u2.HTTPPasswordMgrWithDefaultRealm())
-    u2opener = None
-    if proxy:
-        if proxy_username:
-            proxy_netloc = urlparse.urlsplit(proxy).netloc
-            if proxy_password:
-                proxy_url = 'http://%s:%s@%s' % (proxy_username, proxy_password, proxy_netloc)
-            else:
-                proxy_url = 'http://%s@%s' % (proxy_username, proxy_netloc)
-        else:
-            proxy_url = proxy
-
-        proxy_support = u2.ProxyHandler({'http': proxy_url,
-                                         'https': proxy_url,
-                                         'ftp': proxy_url})
-        handlers.append(proxy_support)
-
-    # download all remote files to one temp dir
-    baseurl = None
-    repo_lic_dir = tempfile.mkdtemp(prefix = 'repolic')
-
-    for url in repo.baseurl:
-        tmphandlers = handlers[:]
-
-        (scheme, host, path, parm, query, frag) = urlparse.urlparse(url.rstrip('/') + '/')
-        if scheme not in ("http", "https", "ftp", "ftps", "file"):
-            raise CreatorError("Error: invalid url %s" % url)
-
-        if '@' in host:
-            try:
-                user_pass, host = host.split('@', 1)
-                if ':' in user_pass:
-                    user, password = user_pass.split(':', 1)
-            except ValueError, e:
-                raise CreatorError('Bad URL: %s' % url)
-
-            msger.verbose("adding HTTP auth: %s, XXXXXXXX" %(user))
-            auth_handler.add_password(None, host, user, password)
-            tmphandlers.append(auth_handler)
-            url = scheme + "://" + host + path + parm + query + frag
-
-        if tmphandlers:
-            u2opener = u2.build_opener(*tmphandlers)
-
-        # try to download
-        repo_eula_url = urlparse.urljoin(url, "LICENSE.txt")
-        repo_eula_path = _check_and_download_url(
-                                u2opener,
-                                repo_eula_url,
-                                os.path.join(repo_lic_dir, repo.id + '_LICENSE.txt'))
-        if repo_eula_path:
-            # found
-            baseurl = url
-            break
-
-    if not baseurl:
-        shutil.rmtree(repo_lic_dir) #cleanup
-        return True
-
-    # show the license file
-    msger.info('For the software packages in this yum repo:')
-    msger.info('    %s: %s' % (name, baseurl))
-    msger.info('There is an "End User License Agreement" file that need to be checked.')
-    msger.info('Please read the terms and conditions outlined in it and answer the followed qustions.')
-    msger.pause()
-
-    _pager_file(repo_eula_path)
-
-    # Asking for the "Accept/Decline"
-    if not msger.ask('Would you agree to the terms and conditions outlined in the above End User License Agreement?'):
-        msger.warning('Will not install pkgs from this repo.')
-        shutil.rmtree(repo_lic_dir) #cleanup
-        return False
-
-    # try to find support_info.html for extra infomation
-    repo_info_url = urlparse.urljoin(baseurl, "support_info.html")
-    repo_info_path = _check_and_download_url(
-                            u2opener,
-                            repo_info_url,
-                            os.path.join(repo_lic_dir, repo.id + '_support_info.html'))
-    if repo_info_path:
-        msger.info('There is one more file in the repo for additional support information, please read it')
-        msger.pause()
-        _pager_file(repo_info_path)
-
-    #cleanup
-    shutil.rmtree(repo_lic_dir)
-    return True
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 13/35] wic: Remove unused fs_related code
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (11 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 12/35] wic: Remove rpmmisc Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 14/35] wic: Remove unused misc code Tom Zanussi
                   ` (21 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use it, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/fs_related.py | 930 ------------------------------------
 1 file changed, 930 deletions(-)

diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/mic/utils/fs_related.py
index 182171f..e6e362d 100644
--- a/scripts/lib/mic/utils/fs_related.py
+++ b/scripts/lib/mic/utils/fs_related.py
@@ -31,19 +31,6 @@ from mic.utils import runner
 from mic.utils.errors import *
 from mic.utils.oe.misc import *
 
-def find_binary_inchroot(binary, chroot):
-    paths = ["/usr/sbin",
-             "/usr/bin",
-             "/sbin",
-             "/bin"
-            ]
-
-    for path in paths:
-        bin_path = "%s/%s" % (path, binary)
-        if os.path.exists("%s/%s" % (chroot, bin_path)):
-            return bin_path
-    return None
-
 def find_binary_path(binary):
     if os.environ.has_key("PATH"):
         paths = os.environ["PATH"].split(":")
@@ -72,176 +59,6 @@ def makedirs(dirname):
         if err.errno != errno.EEXIST:
             raise
 
-def mksquashfs(in_img, out_img):
-    fullpathmksquashfs = find_binary_path("mksquashfs")
-    args = [fullpathmksquashfs, in_img, out_img]
-
-    if not sys.stdout.isatty():
-        args.append("-no-progress")
-
-    ret = runner.show(args)
-    if ret != 0:
-        raise SquashfsError("'%s' exited with error (%d)" % (' '.join(args), ret))
-
-def resize2fs(fs, size):
-    resize2fs = find_binary_path("resize2fs")
-    if size == 0:
-        # it means to minimalize it
-        return runner.show([resize2fs, '-M', fs])
-    else:
-        return runner.show([resize2fs, fs, "%sK" % (size / 1024,)])
-
-def my_fuser(fp):
-    fuser = find_binary_path("fuser")
-    if not os.path.exists(fp):
-        return False
-
-    rc = runner.quiet([fuser, "-s", fp])
-    if rc == 0:
-        for pid in runner.outs([fuser, fp]).split():
-            fd = open("/proc/%s/cmdline" % pid, "r")
-            cmdline = fd.read()
-            fd.close()
-            if cmdline[:-1] == "/bin/bash":
-                return True
-
-    # not found
-    return False
-
-class BindChrootMount:
-    """Represents a bind mount of a directory into a chroot."""
-    def __init__(self, src, chroot, dest = None, option = None):
-        self.root = os.path.abspath(os.path.expanduser(chroot))
-        self.option = option
-
-        self.orig_src = self.src = src
-        if os.path.islink(src):
-            self.src = os.readlink(src)
-            if not self.src.startswith('/'):
-                self.src = os.path.abspath(os.path.join(os.path.dirname(src),
-                                                        self.src))
-
-        if not dest:
-            dest = self.src
-        self.dest = os.path.join(self.root, dest.lstrip('/'))
-
-        self.mounted = False
-        self.mountcmd = find_binary_path("mount")
-        self.umountcmd = find_binary_path("umount")
-
-    def ismounted(self):
-        with open('/proc/mounts') as f:
-            for line in f:
-                if line.split()[1] == os.path.abspath(self.dest):
-                    return True
-
-        return False
-
-    def has_chroot_instance(self):
-        lock = os.path.join(self.root, ".chroot.lock")
-        return my_fuser(lock)
-
-    def mount(self):
-        if self.mounted or self.ismounted():
-            return
-
-        makedirs(self.dest)
-        rc = runner.show([self.mountcmd, "--bind", self.src, self.dest])
-        if rc != 0:
-            raise MountError("Bind-mounting '%s' to '%s' failed" %
-                             (self.src, self.dest))
-        if self.option:
-            rc = runner.show([self.mountcmd, "--bind", "-o", "remount,%s" % self.option, self.dest])
-            if rc != 0:
-                raise MountError("Bind-remounting '%s' failed" % self.dest)
-
-        self.mounted = True
-        if os.path.islink(self.orig_src):
-            dest = os.path.join(self.root, self.orig_src.lstrip('/'))
-            if not os.path.exists(dest):
-                os.symlink(self.src, dest)
-
-    def unmount(self):
-        if self.has_chroot_instance():
-            return
-
-        if self.ismounted():
-            runner.show([self.umountcmd, "-l", self.dest])
-        self.mounted = False
-
-class LoopbackMount:
-    """LoopbackMount  compatibility layer for old API"""
-    def __init__(self, lofile, mountdir, fstype = None):
-        self.diskmount = DiskMount(LoopbackDisk(lofile,size = 0),mountdir,fstype,rmmountdir = True)
-        self.losetup = False
-        self.losetupcmd = find_binary_path("losetup")
-
-    def cleanup(self):
-        self.diskmount.cleanup()
-
-    def unmount(self):
-        self.diskmount.unmount()
-
-    def lounsetup(self):
-        if self.losetup:
-            runner.show([self.losetupcmd, "-d", self.loopdev])
-            self.losetup = False
-            self.loopdev = None
-
-    def loopsetup(self):
-        if self.losetup:
-            return
-
-        self.loopdev = get_loop_device(self.losetupcmd, self.lofile)
-        self.losetup = True
-
-    def mount(self):
-        self.diskmount.mount()
-
-class SparseLoopbackMount(LoopbackMount):
-    """SparseLoopbackMount  compatibility layer for old API"""
-    def __init__(self, lofile, mountdir, size, fstype = None):
-        self.diskmount = DiskMount(SparseLoopbackDisk(lofile,size),mountdir,fstype,rmmountdir = True)
-
-    def expand(self, create = False, size = None):
-        self.diskmount.disk.expand(create, size)
-
-    def truncate(self, size = None):
-        self.diskmount.disk.truncate(size)
-
-    def create(self):
-        self.diskmount.disk.create()
-
-class SparseExtLoopbackMount(SparseLoopbackMount):
-    """SparseExtLoopbackMount  compatibility layer for old API"""
-    def __init__(self, lofile, mountdir, size, fstype, blocksize, fslabel):
-        self.diskmount = ExtDiskMount(SparseLoopbackDisk(lofile,size), mountdir, fstype, blocksize, fslabel, rmmountdir = True)
-
-
-    def __format_filesystem(self):
-        self.diskmount.__format_filesystem()
-
-    def create(self):
-        self.diskmount.disk.create()
-
-    def resize(self, size = None):
-        return self.diskmount.__resize_filesystem(size)
-
-    def mount(self):
-        self.diskmount.mount()
-
-    def __fsck(self):
-        self.extdiskmount.__fsck()
-
-    def __get_size_from_filesystem(self):
-        return self.diskmount.__get_size_from_filesystem()
-
-    def __resize_to_minimal(self):
-        return self.diskmount.__resize_to_minimal()
-
-    def resparse(self, size = None):
-        return self.diskmount.resparse(size)
-
 class Disk:
     """Generic base object for a disk
 
@@ -270,20 +87,6 @@ class Disk:
     size = property(get_size)
 
 
-class RawDisk(Disk):
-    """A Disk backed by a block device.
-    Note that create() is a no-op.
-    """
-    def __init__(self, size, device):
-        Disk.__init__(self, size, device)
-
-    def fixed(self):
-        return True
-
-    def exists(self):
-        return True
-
-
 class DiskImage(Disk):
     """
     A Disk backed by a file.
@@ -311,76 +114,6 @@ class DiskImage(Disk):
         self.device = self.image_file
 
 
-class LoopbackDisk(Disk):
-    """A Disk backed by a file via the loop module."""
-    def __init__(self, lofile, size):
-        Disk.__init__(self, size)
-        self.lofile = lofile
-        self.losetupcmd = find_binary_path("losetup")
-
-    def fixed(self):
-        return False
-
-    def exists(self):
-        return os.path.exists(self.lofile)
-
-    def create(self):
-        if self.device is not None:
-            return
-
-        self.device = get_loop_device(self.losetupcmd, self.lofile)
-
-    def cleanup(self):
-        if self.device is None:
-            return
-        msger.debug("Losetup remove %s" % self.device)
-        rc = runner.show([self.losetupcmd, "-d", self.device])
-        self.device = None
-
-class SparseLoopbackDisk(LoopbackDisk):
-    """A Disk backed by a sparse file via the loop module."""
-    def __init__(self, lofile, size):
-        LoopbackDisk.__init__(self, lofile, size)
-
-    def expand(self, create = False, size = None):
-        flags = os.O_WRONLY
-        if create:
-            flags |= os.O_CREAT
-            if not os.path.exists(self.lofile):
-                makedirs(os.path.dirname(self.lofile))
-
-        if size is None:
-            size = self.size
-
-        msger.debug("Extending sparse file %s to %d" % (self.lofile, size))
-        if create:
-            fd = os.open(self.lofile, flags, 0644)
-        else:
-            fd = os.open(self.lofile, flags)
-
-        if size <= 0:
-            size = 1
-        try:
-            os.ftruncate(fd, size)
-        except:
-            # may be limited by 2G in 32bit env
-            os.ftruncate(fd, 2**31L)
-
-        os.close(fd)
-
-    def truncate(self, size = None):
-        if size is None:
-            size = self.size
-
-        msger.debug("Truncating sparse file %s to %d" % (self.lofile, size))
-        fd = os.open(self.lofile, os.O_WRONLY)
-        os.ftruncate(fd, size)
-        os.close(fd)
-
-    def create(self):
-        self.expand(create = True)
-        LoopbackDisk.create(self)
-
 class Mount:
     """A generic base class to deal with mounting things."""
     def __init__(self, mountdir):
@@ -395,666 +128,3 @@ class Mount:
     def unmount(self):
         pass
 
-class DiskMount(Mount):
-    """A Mount object that handles mounting of a Disk."""
-    def __init__(self, disk, mountdir, fstype = None, rmmountdir = True):
-        Mount.__init__(self, mountdir)
-
-        self.disk = disk
-        self.fstype = fstype
-        self.rmmountdir = rmmountdir
-
-        self.mounted = False
-        self.rmdir   = False
-        if fstype:
-            self.mkfscmd = find_binary_path("mkfs." + self.fstype)
-        else:
-            self.mkfscmd = None
-        self.mountcmd = find_binary_path("mount")
-        self.umountcmd = find_binary_path("umount")
-
-    def cleanup(self):
-        Mount.cleanup(self)
-        self.disk.cleanup()
-
-    def unmount(self):
-        if self.mounted:
-            msger.debug("Unmounting directory %s" % self.mountdir)
-            runner.quiet('sync') # sync the data on this mount point
-            rc = runner.show([self.umountcmd, "-l", self.mountdir])
-            if rc == 0:
-                self.mounted = False
-            else:
-                raise MountError("Failed to umount %s" % self.mountdir)
-        if self.rmdir and not self.mounted:
-            try:
-                os.rmdir(self.mountdir)
-            except OSError, e:
-                pass
-            self.rmdir = False
-
-
-    def __create(self):
-        self.disk.create()
-
-
-    def mount(self, options = None):
-        if self.mounted:
-            return
-
-        if not os.path.isdir(self.mountdir):
-            msger.debug("Creating mount point %s" % self.mountdir)
-            os.makedirs(self.mountdir)
-            self.rmdir = self.rmmountdir
-
-        self.__create()
-
-        msger.debug("Mounting %s at %s" % (self.disk.device, self.mountdir))
-        if options:
-            args = [ self.mountcmd, "-o", options, self.disk.device, self.mountdir ]
-        else:
-            args = [ self.mountcmd, self.disk.device, self.mountdir ]
-        if self.fstype:
-            args.extend(["-t", self.fstype])
-
-        rc = runner.show(args)
-        if rc != 0:
-            raise MountError("Failed to mount '%s' to '%s' with command '%s'. Retval: %s" %
-                             (self.disk.device, self.mountdir, " ".join(args), rc))
-
-        self.mounted = True
-
-class ExtDiskMount(DiskMount):
-    """A DiskMount object that is able to format/resize ext[23] filesystems."""
-    def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None):
-        DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
-        self.blocksize = blocksize
-        self.fslabel = fslabel.replace("/", "")
-        self.uuid = str(uuid.uuid4())
-        self.skipformat = skipformat
-        self.fsopts = fsopts
-        self.extopts = None
-        self.dumpe2fs = find_binary_path("dumpe2fs")
-        self.tune2fs = find_binary_path("tune2fs")
-
-    def __parse_field(self, output, field):
-        for line in output.split("\n"):
-            if line.startswith(field + ":"):
-                return line[len(field) + 1:].strip()
-
-        raise KeyError("Failed to find field '%s' in output" % field)
-
-    def __format_filesystem(self):
-        if self.skipformat:
-            msger.debug("Skip filesystem format.")
-            return
-
-        msger.verbose("Formating %s filesystem on %s" % (self.fstype, self.disk.device))
-        cmdlist = [self.mkfscmd, "-F", "-L", self.fslabel, "-m", "1", "-b",
-                   str(self.blocksize), "-U", self.uuid]
-        if self.extopts:
-            cmdlist.extend(self.extopts.split())
-        cmdlist.extend([self.disk.device])
-
-        rc, errout = runner.runtool(cmdlist, catch=2)
-        if rc != 0:
-            raise MountError("Error creating %s filesystem on disk %s:\n%s" %
-                             (self.fstype, self.disk.device, errout))
-
-        if not self.extopts:
-            msger.debug("Tuning filesystem on %s" % self.disk.device)
-            runner.show([self.tune2fs, "-c0", "-i0", "-Odir_index", "-ouser_xattr,acl", self.disk.device])
-
-    def __resize_filesystem(self, size = None):
-        current_size = os.stat(self.disk.lofile)[stat.ST_SIZE]
-
-        if size is None:
-            size = self.disk.size
-
-        if size == current_size:
-            return
-
-        if size > current_size:
-            self.disk.expand(size)
-
-        self.__fsck()
-
-        resize2fs(self.disk.lofile, size)
-        return size
-
-    def __create(self):
-        resize = False
-        if not self.disk.fixed() and self.disk.exists():
-            resize = True
-
-        self.disk.create()
-
-        if resize:
-            self.__resize_filesystem()
-        else:
-            self.__format_filesystem()
-
-    def mount(self, options = None):
-        self.__create()
-        DiskMount.mount(self, options)
-
-    def __fsck(self):
-        msger.info("Checking filesystem %s" % self.disk.lofile)
-        runner.quiet(["/sbin/e2fsck", "-f", "-y", self.disk.lofile])
-
-    def __get_size_from_filesystem(self):
-        return int(self.__parse_field(runner.outs([self.dumpe2fs, '-h', self.disk.lofile]),
-                                      "Block count")) * self.blocksize
-
-    def __resize_to_minimal(self):
-        self.__fsck()
-
-        #
-        # Use a binary search to find the minimal size
-        # we can resize the image to
-        #
-        bot = 0
-        top = self.__get_size_from_filesystem()
-        while top != (bot + 1):
-            t = bot + ((top - bot) / 2)
-
-            if not resize2fs(self.disk.lofile, t):
-                top = t
-            else:
-                bot = t
-        return top
-
-    def resparse(self, size = None):
-        self.cleanup()
-        if size == 0:
-            minsize = 0
-        else:
-            minsize = self.__resize_to_minimal()
-            self.disk.truncate(minsize)
-
-        self.__resize_filesystem(size)
-        return minsize
-
-class VfatDiskMount(DiskMount):
-    """A DiskMount object that is able to format vfat/msdos filesystems."""
-    def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None):
-        DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
-        self.blocksize = blocksize
-        self.fslabel = fslabel.replace("/", "")
-        rand1 = random.randint(0, 2**16 - 1)
-        rand2 = random.randint(0, 2**16 - 1)
-        self.uuid = "%04X-%04X" % (rand1, rand2)
-        self.skipformat = skipformat
-        self.fsopts = fsopts
-        self.fsckcmd = find_binary_path("fsck." + self.fstype)
-
-    def __format_filesystem(self):
-        if self.skipformat:
-            msger.debug("Skip filesystem format.")
-            return
-
-        msger.verbose("Formating %s filesystem on %s" % (self.fstype, self.disk.device))
-        rc = runner.show([self.mkfscmd, "-n", self.fslabel,
-                          "-i", self.uuid.replace("-", ""), self.disk.device])
-        if rc != 0:
-            raise MountError("Error creating %s filesystem on disk %s" % (self.fstype,self.disk.device))
-
-        msger.verbose("Tuning filesystem on %s" % self.disk.device)
-
-    def __resize_filesystem(self, size = None):
-        current_size = os.stat(self.disk.lofile)[stat.ST_SIZE]
-
-        if size is None:
-            size = self.disk.size
-
-        if size == current_size:
-            return
-
-        if size > current_size:
-            self.disk.expand(size)
-
-        self.__fsck()
-
-        #resize2fs(self.disk.lofile, size)
-        return size
-
-    def __create(self):
-        resize = False
-        if not self.disk.fixed() and self.disk.exists():
-            resize = True
-
-        self.disk.create()
-
-        if resize:
-            self.__resize_filesystem()
-        else:
-            self.__format_filesystem()
-
-    def mount(self, options = None):
-        self.__create()
-        DiskMount.mount(self, options)
-
-    def __fsck(self):
-        msger.debug("Checking filesystem %s" % self.disk.lofile)
-        runner.show([self.fsckcmd, "-y", self.disk.lofile])
-
-    def __get_size_from_filesystem(self):
-        return self.disk.size
-
-    def __resize_to_minimal(self):
-        self.__fsck()
-
-        #
-        # Use a binary search to find the minimal size
-        # we can resize the image to
-        #
-        bot = 0
-        top = self.__get_size_from_filesystem()
-        return top
-
-    def resparse(self, size = None):
-        self.cleanup()
-        minsize = self.__resize_to_minimal()
-        self.disk.truncate(minsize)
-        self.__resize_filesystem(size)
-        return minsize
-
-class BtrfsDiskMount(DiskMount):
-    """A DiskMount object that is able to format/resize btrfs filesystems."""
-    def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None):
-        self.__check_btrfs()
-        DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
-        self.blocksize = blocksize
-        self.fslabel = fslabel.replace("/", "")
-        self.uuid  = None
-        self.skipformat = skipformat
-        self.fsopts = fsopts
-        self.blkidcmd = find_binary_path("blkid")
-        self.btrfsckcmd = find_binary_path("btrfsck")
-
-    def __check_btrfs(self):
-        found = False
-        """ Need to load btrfs module to mount it """
-        load_module("btrfs")
-        for line in open("/proc/filesystems").xreadlines():
-            if line.find("btrfs") > -1:
-                found = True
-                break
-        if not found:
-            raise MountError("Your system can't mount btrfs filesystem, please make sure your kernel has btrfs support and the module btrfs.ko has been loaded.")
-
-        # disable selinux, selinux will block write
-        if os.path.exists("/usr/sbin/setenforce"):
-            runner.show(["/usr/sbin/setenforce", "0"])
-
-    def __parse_field(self, output, field):
-        for line in output.split(" "):
-            if line.startswith(field + "="):
-                return line[len(field) + 1:].strip().replace("\"", "")
-
-        raise KeyError("Failed to find field '%s' in output" % field)
-
-    def __format_filesystem(self):
-        if self.skipformat:
-            msger.debug("Skip filesystem format.")
-            return
-
-        msger.verbose("Formating %s filesystem on %s" % (self.fstype, self.disk.device))
-        rc = runner.show([self.mkfscmd, "-L", self.fslabel, self.disk.device])
-        if rc != 0:
-            raise MountError("Error creating %s filesystem on disk %s" % (self.fstype,self.disk.device))
-
-        self.uuid = self.__parse_field(runner.outs([self.blkidcmd, self.disk.device]), "UUID")
-
-    def __resize_filesystem(self, size = None):
-        current_size = os.stat(self.disk.lofile)[stat.ST_SIZE]
-
-        if size is None:
-            size = self.disk.size
-
-        if size == current_size:
-            return
-
-        if size > current_size:
-            self.disk.expand(size)
-
-        self.__fsck()
-        return size
-
-    def __create(self):
-        resize = False
-        if not self.disk.fixed() and self.disk.exists():
-            resize = True
-
-        self.disk.create()
-
-        if resize:
-            self.__resize_filesystem()
-        else:
-            self.__format_filesystem()
-
-    def mount(self, options = None):
-        self.__create()
-        DiskMount.mount(self, options)
-
-    def __fsck(self):
-        msger.debug("Checking filesystem %s" % self.disk.lofile)
-        runner.quiet([self.btrfsckcmd, self.disk.lofile])
-
-    def __get_size_from_filesystem(self):
-        return self.disk.size
-
-    def __resize_to_minimal(self):
-        self.__fsck()
-
-        return self.__get_size_from_filesystem()
-
-    def resparse(self, size = None):
-        self.cleanup()
-        minsize = self.__resize_to_minimal()
-        self.disk.truncate(minsize)
-        self.__resize_filesystem(size)
-        return minsize
-
-class DeviceMapperSnapshot(object):
-    def __init__(self, imgloop, cowloop):
-        self.imgloop = imgloop
-        self.cowloop = cowloop
-
-        self.__created = False
-        self.__name = None
-        self.dmsetupcmd = find_binary_path("dmsetup")
-
-        """Load dm_snapshot if it isn't loaded"""
-        load_module("dm_snapshot")
-
-    def get_path(self):
-        if self.__name is None:
-            return None
-        return os.path.join("/dev/mapper", self.__name)
-    path = property(get_path)
-
-    def create(self):
-        if self.__created:
-            return
-
-        self.imgloop.create()
-        self.cowloop.create()
-
-        self.__name = "imgcreate-%d-%d" % (os.getpid(),
-                                           random.randint(0, 2**16))
-
-        size = os.stat(self.imgloop.lofile)[stat.ST_SIZE]
-
-        table = "0 %d snapshot %s %s p 8" % (size / 512,
-                                             self.imgloop.device,
-                                             self.cowloop.device)
-
-        args = [self.dmsetupcmd, "create", self.__name, "--table", table]
-        if runner.show(args) != 0:
-            self.cowloop.cleanup()
-            self.imgloop.cleanup()
-            raise SnapshotError("Could not create snapshot device using: " + ' '.join(args))
-
-        self.__created = True
-
-    def remove(self, ignore_errors = False):
-        if not self.__created:
-            return
-
-        time.sleep(2)
-        rc = runner.show([self.dmsetupcmd, "remove", self.__name])
-        if not ignore_errors and rc != 0:
-            raise SnapshotError("Could not remove snapshot device")
-
-        self.__name = None
-        self.__created = False
-
-        self.cowloop.cleanup()
-        self.imgloop.cleanup()
-
-    def get_cow_used(self):
-        if not self.__created:
-            return 0
-
-        #
-        # dmsetup status on a snapshot returns e.g.
-        #   "0 8388608 snapshot 416/1048576"
-        # or, more generally:
-        #   "A B snapshot C/D"
-        # where C is the number of 512 byte sectors in use
-        #
-        out = runner.outs([self.dmsetupcmd, "status", self.__name])
-        try:
-            return int((out.split()[3]).split('/')[0]) * 512
-        except ValueError:
-            raise SnapshotError("Failed to parse dmsetup status: " + out)
-
-def create_image_minimizer(path, image, minimal_size):
-    """
-    Builds a copy-on-write image which can be used to
-    create a device-mapper snapshot of an image where
-    the image's filesystem is as small as possible
-
-    The steps taken are:
-      1) Create a sparse COW
-      2) Loopback mount the image and the COW
-      3) Create a device-mapper snapshot of the image
-         using the COW
-      4) Resize the filesystem to the minimal size
-      5) Determine the amount of space used in the COW
-      6) Restroy the device-mapper snapshot
-      7) Truncate the COW, removing unused space
-      8) Create a squashfs of the COW
-    """
-    imgloop = LoopbackDisk(image, None) # Passing bogus size - doesn't matter
-
-    cowloop = SparseLoopbackDisk(os.path.join(os.path.dirname(path), "osmin"),
-                                 64L * 1024L * 1024L)
-
-    snapshot = DeviceMapperSnapshot(imgloop, cowloop)
-
-    try:
-        snapshot.create()
-
-        resize2fs(snapshot.path, minimal_size)
-
-        cow_used = snapshot.get_cow_used()
-    finally:
-        snapshot.remove(ignore_errors = (not sys.exc_info()[0] is None))
-
-    cowloop.truncate(cow_used)
-
-    mksquashfs(cowloop.lofile, path)
-
-    os.unlink(cowloop.lofile)
-
-def load_module(module):
-    found = False
-    for line in open('/proc/modules').xreadlines():
-        if line.startswith("%s " % module):
-            found = True
-            break
-    if not found:
-        msger.info("Loading %s..." % module)
-        runner.quiet(['modprobe', module])
-
-class LoopDevice(object):
-    def __init__(self, loopid=None):
-        self.device = None
-        self.loopid = loopid
-        self.created = False
-        self.kpartxcmd = find_binary_path("kpartx")
-        self.losetupcmd = find_binary_path("losetup")
-
-    def register(self, device):
-        self.device = device
-        self.loopid = None
-        self.created = True
-
-    def reg_atexit(self):
-        import atexit
-        atexit.register(self.close)
-
-    def _genloopid(self):
-        import glob
-        if not glob.glob("/dev/loop[0-9]*"):
-            return 10
-
-        fint = lambda x: x[9:].isdigit() and int(x[9:]) or 0
-        maxid = 1 + max(filter(lambda x: x<100,
-                               map(fint, glob.glob("/dev/loop[0-9]*"))))
-        if maxid < 10: maxid = 10
-        if maxid >= 100: raise
-        return maxid
-
-    def _kpseek(self, device):
-        rc, out = runner.runtool([self.kpartxcmd, '-l', '-v', device])
-        if rc != 0:
-            raise MountError("Can't query dm snapshot on %s" % device)
-        for line in out.splitlines():
-            if line and line.startswith("loop"):
-                return True
-        return False
-
-    def _loseek(self, device):
-        import re
-        rc, out = runner.runtool([self.losetupcmd, '-a'])
-        if rc != 0:
-            raise MountError("Failed to run 'losetup -a'")
-        for line in out.splitlines():
-            m = re.match("([^:]+): .*", line)
-            if m and m.group(1) == device:
-                return True
-        return False
-
-    def create(self):
-        if not self.created:
-            if not self.loopid:
-                self.loopid = self._genloopid()
-            self.device = "/dev/loop%d" % self.loopid
-            if os.path.exists(self.device):
-                if self._loseek(self.device):
-                    raise MountError("Device busy: %s" % self.device)
-                else:
-                    self.created = True
-                    return
-
-            mknod = find_binary_path('mknod')
-            rc = runner.show([mknod, '-m664', self.device, 'b', '7', str(self.loopid)])
-            if rc != 0:
-                raise MountError("Failed to create device %s" % self.device)
-            else:
-                self.created = True
-
-    def close(self):
-        if self.created:
-            try:
-                self.cleanup()
-                self.device = None
-            except MountError, e:
-                msger.error("%s" % e)
-
-    def cleanup(self):
-
-        if self.device is None:
-            return
-
-
-        if self._kpseek(self.device):
-            if self.created:
-                for i in range(3, os.sysconf("SC_OPEN_MAX")):
-                    try:
-                        os.close(i)
-                    except:
-                        pass
-            runner.quiet([self.kpartxcmd, "-d", self.device])
-        if self._loseek(self.device):
-            runner.quiet([self.losetupcmd, "-d", self.device])
-        # FIXME: should sleep a while between two loseek
-        if self._loseek(self.device):
-            msger.warning("Can't cleanup loop device %s" % self.device)
-        elif self.loopid:
-            os.unlink(self.device)
-
-DEVICE_PIDFILE_DIR = "/var/tmp/mic/device"
-DEVICE_LOCKFILE = "/var/lock/__mic_loopdev.lock"
-
-def get_loop_device(losetupcmd, lofile):
-    global DEVICE_PIDFILE_DIR
-    global DEVICE_LOCKFILE
-
-    import fcntl
-    makedirs(os.path.dirname(DEVICE_LOCKFILE))
-    fp = open(DEVICE_LOCKFILE, 'w')
-    fcntl.flock(fp, fcntl.LOCK_EX)
-    try:
-        loopdev = None
-        devinst = LoopDevice()
-
-        # clean up left loop device first
-        clean_loop_devices()
-
-        # provide an avaible loop device
-        rc, out = runner.runtool([losetupcmd, "--find"])
-        if rc == 0:
-            loopdev = out.split()[0]
-            devinst.register(loopdev)
-        if not loopdev or not os.path.exists(loopdev):
-            devinst.create()
-            loopdev = devinst.device
-
-        # setup a loop device for image file
-        rc = runner.show([losetupcmd, loopdev, lofile])
-        if rc != 0:
-            raise MountError("Failed to setup loop device for '%s'" % lofile)
-
-        devinst.reg_atexit()
-
-        # try to save device and pid
-        makedirs(DEVICE_PIDFILE_DIR)
-        pidfile = os.path.join(DEVICE_PIDFILE_DIR, os.path.basename(loopdev))
-        if os.path.exists(pidfile):
-            os.unlink(pidfile)
-        with open(pidfile, 'w') as wf:
-            wf.write(str(os.getpid()))
-
-    except MountError, err:
-        raise CreatorError("%s" % str(err))
-    except:
-        raise
-    finally:
-        try:
-            fcntl.flock(fp, fcntl.LOCK_UN)
-            fp.close()
-            os.unlink(DEVICE_LOCKFILE)
-        except:
-            pass
-
-    return loopdev
-
-def clean_loop_devices(piddir=DEVICE_PIDFILE_DIR):
-    if not os.path.exists(piddir) or not os.path.isdir(piddir):
-        return
-
-    for loopdev in os.listdir(piddir):
-        pidfile = os.path.join(piddir, loopdev)
-        try:
-            with open(pidfile, 'r') as rf:
-                devpid = int(rf.read())
-        except:
-            devpid = None
-
-        # if the process using this device is alive, skip it
-        if not devpid or os.path.exists(os.path.join('/proc', str(devpid))):
-            continue
-
-        # try to clean it up
-        try:
-            devinst = LoopDevice()
-            devinst.register(os.path.join('/dev', loopdev))
-            devinst.cleanup()
-            os.unlink(pidfile)
-        except:
-            pass
-
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 14/35] wic: Remove unused misc code
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (12 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 13/35] wic: Remove unused fs_related code Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 15/35] wic: Remove 3rdparty/urlgrabber Tom Zanussi
                   ` (20 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use it, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/misc.py | 180 +-----------------------------------------
 1 file changed, 1 insertion(+), 179 deletions(-)

diff --git a/scripts/lib/mic/utils/misc.py b/scripts/lib/mic/utils/misc.py
index 8c1f016..010b16c 100644
--- a/scripts/lib/mic/utils/misc.py
+++ b/scripts/lib/mic/utils/misc.py
@@ -18,29 +18,9 @@
 import os
 import sys
 import time
-import tempfile
-import re
-import shutil
-import glob
-import hashlib
-import subprocess
-import platform
-import traceback
-
-
-try:
-    import sqlite3 as sqlite
-except ImportError:
-    import sqlite
-
-try:
-    from xml.etree import cElementTree
-except ImportError:
-    import cElementTree
-xmlparse = cElementTree.parse
 
 from mic import msger
-from mic.utils.errors import CreatorError, SquashfsError
+from mic.utils.errors import CreatorError
 from mic.utils.fs_related import find_binary_path, makedirs
 from mic.utils import runner
 
@@ -82,115 +62,6 @@ def build_name(kscfg, release=None, prefix = None, suffix = None):
     ret = prefix + name + suffix
     return ret
 
-def get_distro():
-    """Detect linux distribution, support "meego"
-    """
-
-    support_dists = ('SuSE',
-                     'debian',
-                     'fedora',
-                     'redhat',
-                     'centos',
-                     'meego',
-                     'moblin',
-                     'tizen')
-    try:
-        (dist, ver, id) = platform.linux_distribution( \
-                              supported_dists = support_dists)
-    except:
-        (dist, ver, id) = platform.dist( \
-                              supported_dists = support_dists)
-
-    return (dist, ver, id)
-
-def get_distro_str():
-    """Get composited string for current linux distribution
-    """
-    (dist, ver, id) = get_distro()
-
-    if not dist:
-        return 'Unknown Linux Distro'
-    else:
-        distro_str = ' '.join(map(str.strip, (dist, ver, id)))
-        return distro_str.strip()
-
-_LOOP_RULE_PTH = None
-
-def human_size(size):
-    """Return human readable string for Bytes size
-    """
-
-    if size <= 0:
-        return "0M"
-    import math
-    measure = ['B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
-    expo = int(math.log(size, 1024))
-    mant = float(size/math.pow(1024, expo))
-    return "{0:.1f}{1:s}".format(mant, measure[expo])
-
-def get_block_size(file_obj):
-    """ Returns block size for file object 'file_obj'. Errors are indicated by
-    the 'IOError' exception. """
-
-    from fcntl import ioctl
-    import struct
-
-    # Get the block size of the host file-system for the image file by calling
-    # the FIGETBSZ ioctl (number 2).
-    binary_data = ioctl(file_obj, 2, struct.pack('I', 0))
-    return struct.unpack('I', binary_data)[0]
-
-def check_space_pre_cp(src, dst):
-    """Check whether disk space is enough before 'cp' like
-    operations, else exception will be raised.
-    """
-
-    srcsize  = get_file_size(src) * 1024 * 1024
-    freesize = get_filesystem_avail(dst)
-    if srcsize > freesize:
-        raise CreatorError("space on %s(%s) is not enough for about %s files"
-                           % (dst, human_size(freesize), human_size(srcsize)))
-
-def calc_hashes(file_path, hash_names, start = 0, end = None):
-    """ Calculate hashes for a file. The 'file_path' argument is the file
-    to calculate hash functions for, 'start' and 'end' are the starting and
-    ending file offset to calculate the has functions for. The 'hash_names'
-    argument is a list of hash names to calculate. Returns the the list
-    of calculated hash values in the hexadecimal form in the same order
-    as 'hash_names'.
-    """
-    if end == None:
-        end = os.path.getsize(file_path)
-
-    chunk_size = 65536
-    to_read = end - start
-    read = 0
-
-    hashes = []
-    for hash_name in hash_names:
-        hashes.append(hashlib.new(hash_name))
-
-    with open(file_path, "rb") as f:
-        f.seek(start)
-
-        while read < to_read:
-            if read + chunk_size > to_read:
-                chunk_size = to_read - read
-            chunk = f.read(chunk_size)
-            for hash_obj in hashes:
-                hash_obj.update(chunk)
-            read += chunk_size
-
-    result = []
-    for hash_obj in hashes:
-        result.append(hash_obj.hexdigest())
-
-    return result
-
-def get_md5sum(fpath):
-    return calc_hashes(fpath, ('md5', ))[0]
-
-
 def normalize_ksfile(ksconf, release, arch):
     '''
     Return the name of a normalized ks file in which macro variables
@@ -232,52 +103,3 @@ def normalize_ksfile(ksconf, release, arch):
     atexit.register(remove_temp_ks)
 
     return ksconf
-
-
-def selinux_check(arch, fstypes):
-    try:
-        getenforce = find_binary_path('getenforce')
-    except CreatorError:
-        return
-
-    selinux_status = runner.outs([getenforce])
-    if arch and arch.startswith("arm") and selinux_status == "Enforcing":
-        raise CreatorError("Can't create arm image if selinux is enabled, "
-                           "please run 'setenforce 0' to disable selinux")
-
-    use_btrfs = filter(lambda typ: typ == 'btrfs', fstypes)
-    if use_btrfs and selinux_status == "Enforcing":
-        raise CreatorError("Can't create btrfs image if selinux is enabled,"
-                           " please run 'setenforce 0' to disable selinux")
-
-def get_file_size(filename):
-    """ Return size in MB unit """
-    cmd = ['du', "-s", "-b", "-B", "1M", filename]
-    rc, duOutput  = runner.runtool(cmd)
-    if rc != 0:
-        raise CreatorError("Failed to run: %s" % ' '.join(cmd))
-    size1 = int(duOutput.split()[0])
-
-    cmd = ['du', "-s", "-B", "1M", filename]
-    rc, duOutput = runner.runtool(cmd)
-    if rc != 0:
-        raise CreatorError("Failed to run: %s" % ' '.join(cmd))
-
-    size2 = int(duOutput.split()[0])
-    return max(size1, size2)
-
-
-def get_filesystem_avail(fs):
-    vfstat = os.statvfs(fs)
-    return vfstat.f_bavail * vfstat.f_bsize
-
-def mkdtemp(dir = "/var/tmp", prefix = "wic-tmp-"):
-    """ FIXME: use the dir in wic.conf instead """
-
-    makedirs(dir)
-    return tempfile.mkdtemp(dir = dir, prefix = prefix)
-
-def strip_end(text, suffix):
-    if not text.endswith(suffix):
-        return text
-    return text[:-len(suffix)]
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 15/35] wic: Remove 3rdparty/urlgrabber
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (13 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 14/35] wic: Remove unused misc code Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-09-09 11:48   ` Ola X Nilsson
  2014-08-08 22:05 ` [PATCH 16/35] wic: Remove unused 3rdparty/commands Tom Zanussi
                   ` (19 subsequent siblings)
  34 siblings, 1 reply; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use it, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 .../3rdparty/pykickstart/urlgrabber/__init__.py    |   53 -
 .../3rdparty/pykickstart/urlgrabber/byterange.py   |  463 ------
 .../mic/3rdparty/pykickstart/urlgrabber/grabber.py | 1477 --------------------
 .../3rdparty/pykickstart/urlgrabber/keepalive.py   |  617 --------
 .../mic/3rdparty/pykickstart/urlgrabber/mirror.py  |  458 ------
 .../3rdparty/pykickstart/urlgrabber/progress.py    |  530 -------
 .../3rdparty/pykickstart/urlgrabber/sslfactory.py  |   90 --
 7 files changed, 3688 deletions(-)
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/__init__.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/byterange.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/grabber.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/keepalive.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/mirror.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/progress.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/sslfactory.py

Patch too large to post - see git repository.

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 16/35] wic: Remove unused 3rdparty/commands
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (14 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 15/35] wic: Remove 3rdparty/urlgrabber Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 17/35] wic: Remove gpt_parser Tom Zanussi
                   ` (18 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use anything but partition and bootloader, so remove the
rest.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 .../mic/3rdparty/pykickstart/commands/__init__.py  |    8 +-
 .../3rdparty/pykickstart/commands/authconfig.py    |   40 -
 .../mic/3rdparty/pykickstart/commands/autopart.py  |  119 ---
 .../mic/3rdparty/pykickstart/commands/autostep.py  |   55 -
 .../mic/3rdparty/pykickstart/commands/clearpart.py |   86 --
 .../mic/3rdparty/pykickstart/commands/device.py    |  125 ---
 .../3rdparty/pykickstart/commands/deviceprobe.py   |   40 -
 .../3rdparty/pykickstart/commands/displaymode.py   |   68 --
 .../mic/3rdparty/pykickstart/commands/dmraid.py    |   91 --
 .../3rdparty/pykickstart/commands/driverdisk.py    |  184 ----
 .../lib/mic/3rdparty/pykickstart/commands/fcoe.py  |  114 --
 .../mic/3rdparty/pykickstart/commands/firewall.py  |  193 ----
 .../mic/3rdparty/pykickstart/commands/firstboot.py |   62 --
 .../lib/mic/3rdparty/pykickstart/commands/group.py |   88 --
 .../3rdparty/pykickstart/commands/ignoredisk.py    |  139 ---
 .../3rdparty/pykickstart/commands/interactive.py   |   58 --
 .../lib/mic/3rdparty/pykickstart/commands/iscsi.py |  133 ---
 .../mic/3rdparty/pykickstart/commands/iscsiname.py |   54 -
 .../lib/mic/3rdparty/pykickstart/commands/key.py   |   64 --
 .../mic/3rdparty/pykickstart/commands/keyboard.py  |   55 -
 .../lib/mic/3rdparty/pykickstart/commands/lang.py  |   60 --
 .../3rdparty/pykickstart/commands/langsupport.py   |   58 --
 .../mic/3rdparty/pykickstart/commands/lilocheck.py |   54 -
 .../mic/3rdparty/pykickstart/commands/logging.py   |   66 --
 .../mic/3rdparty/pykickstart/commands/logvol.py    |  304 ------
 .../3rdparty/pykickstart/commands/mediacheck.py    |   53 -
 .../mic/3rdparty/pykickstart/commands/method.py    |  186 ----
 .../mic/3rdparty/pykickstart/commands/monitor.py   |  106 --
 .../lib/mic/3rdparty/pykickstart/commands/mouse.py |   70 --
 .../mic/3rdparty/pykickstart/commands/multipath.py |  111 --
 .../mic/3rdparty/pykickstart/commands/network.py   |  363 -------
 .../lib/mic/3rdparty/pykickstart/commands/raid.py  |  365 -------
 .../mic/3rdparty/pykickstart/commands/reboot.py    |   79 --
 .../lib/mic/3rdparty/pykickstart/commands/repo.py  |  249 -----
 .../mic/3rdparty/pykickstart/commands/rescue.py    |   68 --
 .../mic/3rdparty/pykickstart/commands/rootpw.py    |   93 --
 .../mic/3rdparty/pykickstart/commands/selinux.py   |   64 --
 .../mic/3rdparty/pykickstart/commands/services.py  |   71 --
 .../lib/mic/3rdparty/pykickstart/commands/skipx.py |   54 -
 .../lib/mic/3rdparty/pykickstart/commands/sshpw.py |  105 --
 .../mic/3rdparty/pykickstart/commands/timezone.py  |   86 --
 .../mic/3rdparty/pykickstart/commands/updates.py   |   60 --
 .../mic/3rdparty/pykickstart/commands/upgrade.py   |  106 --
 .../lib/mic/3rdparty/pykickstart/commands/user.py  |  173 ----
 .../lib/mic/3rdparty/pykickstart/commands/vnc.py   |  114 --
 .../mic/3rdparty/pykickstart/commands/volgroup.py  |  102 --
 .../mic/3rdparty/pykickstart/commands/xconfig.py   |  184 ----
 .../mic/3rdparty/pykickstart/commands/zerombr.py   |   69 --
 .../lib/mic/3rdparty/pykickstart/commands/zfcp.py  |  134 ---
 .../mic/3rdparty/pykickstart/handlers/control.py   | 1092 --------------------
 50 files changed, 1 insertion(+), 6474 deletions(-)
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/authconfig.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/autopart.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/autostep.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/clearpart.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/device.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/deviceprobe.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/displaymode.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/dmraid.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/driverdisk.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/fcoe.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/firewall.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/firstboot.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/group.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/ignoredisk.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/interactive.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/iscsiname.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/key.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/keyboard.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/lang.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/langsupport.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/lilocheck.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/logging.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/logvol.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/mediacheck.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/method.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/mouse.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/multipath.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/network.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/raid.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/repo.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/rescue.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/rootpw.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/selinux.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/services.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/skipx.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/sshpw.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/timezone.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/updates.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/upgrade.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/user.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/volgroup.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/zerombr.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py

Patch too large to post - see git repository.

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 17/35] wic: Remove gpt_parser
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (15 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 16/35] wic: Remove unused 3rdparty/commands Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 18/35] wic: Remove unused plugin and error code Tom Zanussi
                   ` (17 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't currently use it, so remove.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/plugins/source/bootimg-efi.py    |   4 +-
 scripts/lib/mic/plugins/source/bootimg-pcbios.py |   8 +-
 scripts/lib/mic/utils/gpt_parser.py              | 331 -----------------------
 scripts/lib/mic/utils/partitionedfs.py           |  58 +---
 4 files changed, 11 insertions(+), 390 deletions(-)
 delete mode 100644 scripts/lib/mic/utils/gpt_parser.py

diff --git a/scripts/lib/mic/plugins/source/bootimg-efi.py b/scripts/lib/mic/plugins/source/bootimg-efi.py
index 95e1c05..d4a7771 100644
--- a/scripts/lib/mic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/mic/plugins/source/bootimg-efi.py
@@ -78,9 +78,7 @@ class BootimgEFIPlugin(SourcePlugin):
         if cr._ptable_format == 'msdos':
             rootstr = rootdev
         else:
-            if not root_part_uuid:
-                raise MountError("Cannot find the root GPT partition UUID")
-            rootstr = "PARTUUID=%s" % root_part_uuid
+            raise MountError("Unsupported partition table format found")
 
         grubefi_conf += "linux %s root=%s rootwait %s\n" \
             % (kernel, rootstr, options)
diff --git a/scripts/lib/mic/plugins/source/bootimg-pcbios.py b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
index 9959645..3434320 100644
--- a/scripts/lib/mic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
@@ -50,9 +50,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         disk image.  In this case, we install the MBR.
         """
         mbrfile = "%s/syslinux/" % bootimg_dir
-        if cr._ptable_format == 'gpt':
-            mbrfile += "gptmbr.bin"
-        else:
+        if cr._ptable_format == 'msdos':
             mbrfile += "mbr.bin"
 
         if not os.path.exists(mbrfile):
@@ -110,9 +108,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         if cr._ptable_format == 'msdos':
             rootstr = rootdev
         else:
-            if not root_part_uuid:
-                raise MountError("Cannot find the root GPT partition UUID")
-            rootstr = "PARTUUID=%s" % root_part_uuid
+            raise MountError("Unsupported partition table format found")
 
         syslinux_conf += "APPEND label=boot root=%s %s\n" % (rootstr, options)
 
diff --git a/scripts/lib/mic/utils/gpt_parser.py b/scripts/lib/mic/utils/gpt_parser.py
deleted file mode 100644
index 5d43b70..0000000
--- a/scripts/lib/mic/utils/gpt_parser.py
+++ /dev/null
@@ -1,331 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2013 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-""" This module implements a simple GPT partitions parser which can read the
-GPT header and the GPT partition table. """
-
-import struct
-import uuid
-import binascii
-from mic.utils.errors import MountError
-
-_GPT_HEADER_FORMAT = "<8s4sIIIQQQQ16sQIII"
-_GPT_HEADER_SIZE = struct.calcsize(_GPT_HEADER_FORMAT)
-_GPT_ENTRY_FORMAT = "<16s16sQQQ72s"
-_GPT_ENTRY_SIZE = struct.calcsize(_GPT_ENTRY_FORMAT)
-_SUPPORTED_GPT_REVISION = '\x00\x00\x01\x00'
-
-def _stringify_uuid(binary_uuid):
-    """ A small helper function to transform a binary UUID into a string
-    format. """
-
-    uuid_str = str(uuid.UUID(bytes_le = binary_uuid))
-
-    return uuid_str.upper()
-
-def _calc_header_crc(raw_hdr):
-    """ Calculate GPT header CRC32 checksum. The 'raw_hdr' parameter has to
-    be a list or a tuple containing all the elements of the GPT header in a
-    "raw" form, meaning that it should simply contain "unpacked" disk data.
-    """
-
-    raw_hdr = list(raw_hdr)
-    raw_hdr[3] = 0
-    raw_hdr = struct.pack(_GPT_HEADER_FORMAT, *raw_hdr)
-
-    return binascii.crc32(raw_hdr) & 0xFFFFFFFF
-
-def _validate_header(raw_hdr):
-    """ Validate the GPT header. The 'raw_hdr' parameter has to be a list or a
-    tuple containing all the elements of the GPT header in a "raw" form,
-    meaning that it should simply contain "unpacked" disk data. """
-
-    # Validate the signature
-    if raw_hdr[0] != 'EFI PART':
-        raise MountError("GPT partition table not found")
-
-    # Validate the revision
-    if raw_hdr[1] != _SUPPORTED_GPT_REVISION:
-        raise MountError("Unsupported GPT revision '%s', supported revision " \
-                         "is '%s'" % \
-                          (binascii.hexlify(raw_hdr[1]),
-                           binascii.hexlify(_SUPPORTED_GPT_REVISION)))
-
-    # Validate header size
-    if raw_hdr[2] != _GPT_HEADER_SIZE:
-        raise MountError("Bad GPT header size: %d bytes, expected %d" % \
-                         (raw_hdr[2], _GPT_HEADER_SIZE))
-
-    crc = _calc_header_crc(raw_hdr)
-    if raw_hdr[3] != crc:
-        raise MountError("GPT header crc mismatch: %#x, should be %#x" % \
-                         (crc, raw_hdr[3]))
-
-class GptParser:
-    """ GPT partition table parser. Allows reading the GPT header and the
-    partition table, as well as modifying the partition table records. """
-
-    def __init__(self, disk_path, sector_size = 512):
-        """ The class constructor which accepts the following parameters:
-            * disk_path - full path to the disk image or device node
-            * sector_size - size of a disk sector in bytes """
-
-        self.sector_size = sector_size
-        self.disk_path = disk_path
-
-        try:
-            self._disk_obj = open(disk_path, 'r+b')
-        except IOError as err:
-            raise MountError("Cannot open file '%s' for reading GPT " \
-                             "partitions: %s" % (disk_path, err))
-
-    def __del__(self):
-        """ The class destructor. """
-
-        self._disk_obj.close()
-
-    def _read_disk(self, offset, size):
-        """ A helper function which reads 'size' bytes from offset 'offset' of
-        the disk and checks all the error conditions. """
-
-        self._disk_obj.seek(offset)
-        try:
-            data = self._disk_obj.read(size)
-        except IOError as err:
-            raise MountError("cannot read from '%s': %s" % \
-                             (self.disk_path, err))
-
-        if len(data) != size:
-            raise MountError("cannot read %d bytes from offset '%d' of '%s', " \
-                             "read only %d bytes" % \
-                             (size, offset, self.disk_path, len(data)))
-
-        return data
-
-    def _write_disk(self, offset, buf):
-        """ A helper function which writes buffer 'buf' to offset 'offset' of
-        the disk. This function takes care of unaligned writes and checks all
-        the error conditions. """
-
-        # Since we may be dealing with a block device, we only can write in
-        # 'self.sector_size' chunks. Find the aligned starting and ending
-        # disk offsets to read.
-        start =  (offset / self.sector_size) * self.sector_size
-        end = ((start + len(buf)) / self.sector_size + 1) * self.sector_size
-
-        data = self._read_disk(start, end - start)
-        off = offset - start
-        data = data[:off] + buf + data[off + len(buf):]
-
-        self._disk_obj.seek(start)
-        try:
-            self._disk_obj.write(data)
-        except IOError as err:
-            raise MountError("cannot write to '%s': %s" % (self.disk_path, err))
-
-    def read_header(self, primary = True):
-        """ Read and verify the GPT header and return a dictionary containing
-        the following elements:
-
-        'signature'   : header signature
-        'revision'    : header revision
-        'hdr_size'    : header size in bytes
-        'hdr_crc'     : header CRC32
-        'hdr_lba'     : LBA of this header
-        'hdr_offs'    : byte disk offset of this header
-        'backup_lba'  : backup header LBA
-        'backup_offs' : byte disk offset of backup header
-        'first_lba'   : first usable LBA for partitions
-        'first_offs'  : first usable byte disk offset for partitions
-        'last_lba'    : last usable LBA for partitions
-        'last_offs'   : last usable byte disk offset for partitions
-        'disk_uuid'   : UUID of the disk
-        'ptable_lba'  : starting LBA of array of partition entries
-        'ptable_offs' : disk byte offset of the start of the partition table
-        'ptable_size' : partition table size in bytes
-        'entries_cnt' : number of available partition table entries
-        'entry_size'  : size of a single partition entry
-        'ptable_crc'  : CRC32 of the partition table
-        'primary'     : a boolean, if 'True', this is the primary GPT header,
-                        if 'False' - the secondary
-        'primary_str' : contains string "primary" if this is the primary GPT
-                        header, and "backup" otherwise
-
-        This dictionary corresponds to the GPT header format. Please, see the
-        UEFI standard for the description of these fields.
-
-        If the 'primary' parameter is 'True', the primary GPT header is read,
-        otherwise the backup GPT header is read instead. """
-
-        # Read and validate the primary GPT header
-        raw_hdr = self._read_disk(self.sector_size, _GPT_HEADER_SIZE)
-        raw_hdr = struct.unpack(_GPT_HEADER_FORMAT, raw_hdr)
-        _validate_header(raw_hdr)
-        primary_str = "primary"
-
-        if not primary:
-            # Read and validate the backup GPT header
-            raw_hdr = self._read_disk(raw_hdr[6] * self.sector_size, _GPT_HEADER_SIZE)
-            raw_hdr = struct.unpack(_GPT_HEADER_FORMAT, raw_hdr)
-            _validate_header(raw_hdr)
-            primary_str = "backup"
-
-        return { 'signature'   : raw_hdr[0],
-                 'revision'    : raw_hdr[1],
-                 'hdr_size'    : raw_hdr[2],
-                 'hdr_crc'     : raw_hdr[3],
-                 'hdr_lba'     : raw_hdr[5],
-                 'hdr_offs'    : raw_hdr[5] * self.sector_size,
-                 'backup_lba'  : raw_hdr[6],
-                 'backup_offs' : raw_hdr[6] * self.sector_size,
-                 'first_lba'   : raw_hdr[7],
-                 'first_offs'  : raw_hdr[7] * self.sector_size,
-                 'last_lba'    : raw_hdr[8],
-                 'last_offs'   : raw_hdr[8] * self.sector_size,
-                 'disk_uuid'   :_stringify_uuid(raw_hdr[9]),
-                 'ptable_lba'  : raw_hdr[10],
-                 'ptable_offs' : raw_hdr[10] * self.sector_size,
-                 'ptable_size' : raw_hdr[11] * raw_hdr[12],
-                 'entries_cnt' : raw_hdr[11],
-                 'entry_size'  : raw_hdr[12],
-                 'ptable_crc'  : raw_hdr[13],
-                 'primary'     : primary,
-                 'primary_str' : primary_str }
-
-    def _read_raw_ptable(self, header):
-        """ Read and validate primary or backup partition table. The 'header'
-        argument is the GPT header. If it is the primary GPT header, then the
-        primary partition table is read and validated, otherwise - the backup
-        one. The 'header' argument is a dictionary which is returned by the
-        'read_header()' method. """
-
-        raw_ptable = self._read_disk(header['ptable_offs'],
-                                     header['ptable_size'])
-
-        crc = binascii.crc32(raw_ptable) & 0xFFFFFFFF
-        if crc != header['ptable_crc']:
-            raise MountError("Partition table at LBA %d (%s) is corrupted" % \
-                             (header['ptable_lba'], header['primary_str']))
-
-        return raw_ptable
-
-    def get_partitions(self, primary = True):
-        """ This is a generator which parses the GPT partition table and
-        generates the following dictionary for each partition:
-
-        'index'       : the index of the partition table endry
-        'offs'        : byte disk offset of the partition table entry
-        'type_uuid'   : partition type UUID
-        'part_uuid'   : partition UUID
-        'first_lba'   : the first LBA
-        'last_lba'    : the last LBA
-        'flags'       : attribute flags
-        'name'        : partition name
-        'primary'     : a boolean, if 'True', this is the primary partition
-                        table, if 'False' - the secondary
-        'primary_str' : contains string "primary" if this is the primary GPT
-                        header, and "backup" otherwise
-
-        This dictionary corresponds to the GPT header format. Please, see the
-        UEFI standard for the description of these fields.
-
-        If the 'primary' parameter is 'True', partitions from the primary GPT
-        partition table are generated, otherwise partitions from the backup GPT
-        partition table are generated. """
-
-        if primary:
-            primary_str = "primary"
-        else:
-            primary_str = "backup"
-
-        header = self.read_header(primary)
-        raw_ptable = self._read_raw_ptable(header)
-
-        for index in xrange(0, header['entries_cnt']):
-            start = header['entry_size'] * index
-            end = start + header['entry_size']
-            raw_entry = struct.unpack(_GPT_ENTRY_FORMAT, raw_ptable[start:end])
-
-            if raw_entry[2] == 0 or raw_entry[3] == 0:
-                continue
-
-            part_name = str(raw_entry[5].decode('UTF-16').split('\0', 1)[0])
-
-            yield { 'index'       : index,
-                    'offs'        : header['ptable_offs'] + start,
-                    'type_uuid'   : _stringify_uuid(raw_entry[0]),
-                    'part_uuid'   : _stringify_uuid(raw_entry[1]),
-                    'first_lba'   : raw_entry[2],
-                    'last_lba'    : raw_entry[3],
-                    'flags'       : raw_entry[4],
-                    'name'        : part_name,
-                    'primary'     : primary,
-                    'primary_str' : primary_str }
-
-    def _change_partition(self, header, entry):
-        """ A helper function for 'change_partitions()' which changes a
-        a paricular instance of the partition table (primary or backup). """
-
-        if entry['index'] >= header['entries_cnt']:
-            raise MountError("Partition table at LBA %d has only %d "   \
-                             "records cannot change record number %d" % \
-                             (header['entries_cnt'], entry['index']))
-        # Read raw GPT header
-        raw_hdr = self._read_disk(header['hdr_offs'], _GPT_HEADER_SIZE)
-        raw_hdr = list(struct.unpack(_GPT_HEADER_FORMAT, raw_hdr))
-        _validate_header(raw_hdr)
-
-        # Prepare the new partition table entry
-        raw_entry = struct.pack(_GPT_ENTRY_FORMAT,
-                                uuid.UUID(entry['type_uuid']).bytes_le,
-                                uuid.UUID(entry['part_uuid']).bytes_le,
-                                entry['first_lba'],
-                                entry['last_lba'],
-                                entry['flags'],
-                                entry['name'].encode('UTF-16'))
-
-        # Write the updated entry to the disk
-        entry_offs = header['ptable_offs'] + \
-                     header['entry_size'] * entry['index']
-        self._write_disk(entry_offs, raw_entry)
-
-        # Calculate and update partition table CRC32
-        raw_ptable = self._read_disk(header['ptable_offs'],
-                                     header['ptable_size'])
-        raw_hdr[13] = binascii.crc32(raw_ptable) & 0xFFFFFFFF
-
-        # Calculate and update the GPT header CRC
-        raw_hdr[3] = _calc_header_crc(raw_hdr)
-
-        # Write the updated header to the disk
-        raw_hdr = struct.pack(_GPT_HEADER_FORMAT, *raw_hdr)
-        self._write_disk(header['hdr_offs'], raw_hdr)
-
-    def change_partition(self, entry):
-        """ Change a GPT partition. The 'entry' argument has the same format as
-        'get_partitions()' returns. This function simply changes the partition
-        table record corresponding to 'entry' in both, the primary and the
-        backup GPT partition tables. The parition table CRC is re-calculated
-        and the GPT headers are modified accordingly. """
-
-        # Change the primary partition table
-        header = self.read_header(True)
-        self._change_partition(header, entry)
-
-        # Change the backup partition table
-        header = self.read_header(False)
-        self._change_partition(header, entry)
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index 83ce869..0c4c9ec 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -24,13 +24,10 @@ from mic import msger
 from mic.utils import runner
 from mic.utils.errors import MountError
 from mic.utils.fs_related import *
-from mic.utils.gpt_parser import GptParser
 from mic.utils.oe.misc import *
 
 # Overhead of the MBR partitioning scheme (just one sector)
 MBR_OVERHEAD = 1
-# Overhead of the GPT partitioning scheme
-GPT_OVERHEAD = 34
 
 # Size of a sector in bytes
 SECTOR_SIZE = 512
@@ -148,21 +145,20 @@ class PartitionedMount(Mount):
                      'num': None, # Partition number
                      'boot': boot, # Bootable flag
                      'align': align, # Partition alignment
-                     'part_type' : part_type, # Partition type
-                     'partuuid': None } # Partition UUID (GPT-only)
+                     'part_type' : part_type } # Partition type
 
             self.__add_partition(part)
 
     def layout_partitions(self, ptable_format = "msdos"):
         """ Layout the partitions, meaning calculate the position of every
         partition on the disk. The 'ptable_format' parameter defines the
-        partition table format, and may be either "msdos" or "gpt". """
+        partition table format and may be "msdos". """
 
         msger.debug("Assigning %s partitions to disks" % ptable_format)
 
-        if ptable_format not in ('msdos', 'gpt'):
+        if ptable_format not in ('msdos'):
             raise MountError("Unknown partition table format '%s', supported " \
-                             "formats are: 'msdos' and 'gpt'" % ptable_format)
+                             "formats are: 'msdos'" % ptable_format)
 
         if self._partitions_layed_out:
             return
@@ -177,12 +173,12 @@ class PartitionedMount(Mount):
                 raise MountError("No disk %s for partition %s" \
                                  % (p['disk_name'], p['mountpoint']))
 
-            if p['part_type'] and ptable_format != 'gpt':
+            if p['part_type']:
                 # The --part-type can also be implemented for MBR partitions,
                 # in which case it would map to the 1-byte "partition type"
                 # filed at offset 3 of the partition entry.
-                raise MountError("setting custom partition type is only " \
-                                 "imlemented for GPT partitions")
+                raise MountError("setting custom partition type is not " \
+                                 "implemented for msdos partitions")
 
             # Get the disk where the partition is located
             d = self.disks[p['disk_name']]
@@ -192,8 +188,6 @@ class PartitionedMount(Mount):
             if d['numpart'] == 1:
                 if ptable_format == "msdos":
                     overhead = MBR_OVERHEAD
-                else:
-                    overhead = GPT_OVERHEAD
 
                 # Skip one sector required for the partitioning scheme overhead
                 d['offset'] += overhead
@@ -250,9 +244,6 @@ class PartitionedMount(Mount):
         # minumim disk sizes.
         for disk_name, d in self.disks.items():
             d['min_size'] = d['offset']
-            if d['ptable_format'] == 'gpt':
-                # Account for the backup partition table at the end of the disk
-                d['min_size'] += GPT_OVERHEAD
 
             d['min_size'] *= self.sector_size
 
@@ -339,10 +330,7 @@ class PartitionedMount(Mount):
                                     parted_fs_type, p['start'], p['size'])
 
             if p['boot']:
-                if d['ptable_format'] == 'gpt':
-                    flag_name = "legacy_boot"
-                else:
-                    flag_name = "boot"
+                flag_name = "boot"
                 msger.debug("Set '%s' flag for partition '%s' on disk '%s'" % \
                             (flag_name, p['num'], d['disk'].device))
                 self.__run_parted(["-s", d['disk'].device, "set",
@@ -358,36 +346,6 @@ class PartitionedMount(Mount):
                     self.__run_parted(["-s", d['disk'].device, "set",
                                        "%d" % p['num'], "lba", "off"])
 
-        # If the partition table format is "gpt", find out PARTUUIDs for all
-        # the partitions. And if users specified custom parition type UUIDs,
-        # set them.
-        for disk_name, disk in self.disks.items():
-            if disk['ptable_format'] != 'gpt':
-                continue
-
-            pnum = 0
-            gpt_parser = GptParser(d['disk'].device, SECTOR_SIZE)
-            # Iterate over all GPT partitions on this disk
-            for entry in gpt_parser.get_partitions():
-                pnum += 1
-                # Find the matching partition in the 'self.partitions' list
-                for n in d['partitions']:
-                    p = self.partitions[n]
-                    if p['num'] == pnum:
-                        # Found, fetch PARTUUID (partition's unique ID)
-                        p['partuuid'] = entry['part_uuid']
-                        msger.debug("PARTUUID for partition %d on disk '%s' " \
-                                    "(mount point '%s') is '%s'" % (pnum, \
-                                    disk_name, p['mountpoint'], p['partuuid']))
-                        if p['part_type']:
-                            entry['type_uuid'] = p['part_type']
-                            msger.debug("Change type of partition %d on disk " \
-                                        "'%s' (mount point '%s') to '%s'" % \
-                                        (pnum, disk_name, p['mountpoint'],
-                                         p['part_type']))
-                            gpt_parser.change_partition(entry)
-
-            del gpt_parser
 
     def __map_partitions(self):
         """Load it if dm_snapshot isn't loaded. """
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 18/35] wic: Remove unused plugin and error code
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (16 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 17/35] wic: Remove gpt_parser Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 19/35] wic: Clean up BaseImageCreator Tom Zanussi
                   ` (16 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use it, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/plugin.py                  |  2 +-
 scripts/lib/mic/pluginbase.py              | 45 ++----------------------------
 scripts/lib/mic/plugins/hook/.py           |  0
 scripts/lib/mic/plugins/hook/empty_hook.py |  3 --
 scripts/lib/mic/utils/errors.py            | 21 --------------
 5 files changed, 3 insertions(+), 68 deletions(-)
 delete mode 100644 scripts/lib/mic/plugins/hook/.py
 delete mode 100644 scripts/lib/mic/plugins/hook/empty_hook.py

diff --git a/scripts/lib/mic/plugin.py b/scripts/lib/mic/plugin.py
index f836950..43afdbc 100644
--- a/scripts/lib/mic/plugin.py
+++ b/scripts/lib/mic/plugin.py
@@ -24,7 +24,7 @@ from mic.utils.oe.misc import *
 
 __ALL__ = ['PluginMgr', 'pluginmgr']
 
-PLUGIN_TYPES = ["imager", "source"] # TODO  "hook"
+PLUGIN_TYPES = ["imager", "source"]
 
 PLUGIN_DIR = "/lib/mic/plugins" # relative to scripts
 SCRIPTS_PLUGIN_DIR = "scripts" + PLUGIN_DIR
diff --git a/scripts/lib/mic/pluginbase.py b/scripts/lib/mic/pluginbase.py
index 9cf4c62..46a4f4a 100644
--- a/scripts/lib/mic/pluginbase.py
+++ b/scripts/lib/mic/pluginbase.py
@@ -40,45 +40,10 @@ class _Plugin(object):
         def get_plugins(cls):
             return cls.plugins
 
+
 class ImagerPlugin(_Plugin):
     mic_plugin_type = "imager"
 
-    @classmethod
-    def check_image_exists(self, destdir, apacking=None,
-                                          images=(),
-                                          release=None):
-
-        # if it's a packing file, reset images
-        if apacking:
-            images = [apacking]
-
-        # release option will override images
-        if release is not None:
-            images = [os.path.basename(destdir.rstrip('/'))]
-            destdir = os.path.dirname(destdir.rstrip('/'))
-
-        for name in images:
-            if not name:
-                continue
-
-            image = os.path.join(destdir, name)
-            if not os.path.exists(image):
-                continue
-
-            if msger.ask("Target image/dir: %s already exists, "
-                         "clean up and continue?" % image):
-                if os.path.isdir(image):
-                    shutil.rmtree(image)
-                else:
-                    os.unlink(image)
-            else:
-                raise errors.Abort("Cancled")
-
-    def do_create(self):
-        pass
-
-    def do_chroot(self):
-        pass
 
 class SourcePlugin(_Plugin):
     mic_plugin_type = "source"
@@ -133,12 +98,6 @@ class SourcePlugin(_Plugin):
         """
         msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part)
 
-class BackendPlugin(_Plugin):
-    mic_plugin_type="backend"
-
-    def addRepository(self):
-        pass
-
 def get_plugins(typen):
     ps = ImagerPlugin.get_plugins()
     if typen in ps:
@@ -146,4 +105,4 @@ def get_plugins(typen):
     else:
         return None
 
-__all__ = ['ImagerPlugin', 'BackendPlugin', 'SourcePlugin', 'get_plugins']
+__all__ = ['ImagerPlugin', 'SourcePlugin', 'get_plugins']
diff --git a/scripts/lib/mic/plugins/hook/.py b/scripts/lib/mic/plugins/hook/.py
deleted file mode 100644
index e69de29..0000000
diff --git a/scripts/lib/mic/plugins/hook/empty_hook.py b/scripts/lib/mic/plugins/hook/empty_hook.py
deleted file mode 100644
index 397585d..0000000
--- a/scripts/lib/mic/plugins/hook/empty_hook.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/python
-
-# TODO: plugin base for hooks
diff --git a/scripts/lib/mic/utils/errors.py b/scripts/lib/mic/utils/errors.py
index 8d720f9..38fda30 100644
--- a/scripts/lib/mic/utils/errors.py
+++ b/scripts/lib/mic/utils/errors.py
@@ -43,29 +43,8 @@ class Usage(CreatorError):
 class Abort(CreatorError):
     keyword = ''
 
-class ConfigError(CreatorError):
-    keyword = '<config>'
-
 class KsError(CreatorError):
     keyword = '<kickstart>'
 
-class RepoError(CreatorError):
-    keyword = '<repo>'
-
-class RpmError(CreatorError):
-    keyword = '<rpm>'
-
 class MountError(CreatorError):
     keyword = '<mount>'
-
-class SnapshotError(CreatorError):
-    keyword = '<snapshot>'
-
-class SquashfsError(CreatorError):
-    keyword = '<squashfs>'
-
-class BootstrapError(CreatorError):
-    keyword = '<bootstrap>'
-
-class RuntimeError(CreatorError):
-    keyword = '<runtime>'
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 19/35] wic: Clean up BaseImageCreator
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (17 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 18/35] wic: Remove unused plugin and error code Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 20/35] wic: Clean up DirectImageCreator Tom Zanussi
                   ` (15 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use a lot of BaseImageCreator, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/baseimager.py | 1030 +---------------------------------
 scripts/lib/mic/imager/direct.py     |    4 +-
 2 files changed, 9 insertions(+), 1025 deletions(-)

diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/mic/imager/baseimager.py
index b721249..55f2dea 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/mic/imager/baseimager.py
@@ -18,37 +18,31 @@
 
 from __future__ import with_statement
 import os, sys
-import stat
 import tempfile
 import shutil
-import subprocess
-import re
-import tarfile
-import glob
 
 from mic import kickstart
 from mic import msger
-from mic.utils.errors import CreatorError, Abort
+from mic.utils.errors import CreatorError
 from mic.utils import misc, runner, fs_related as fs
 
 class BaseImageCreator(object):
-    """Installs a system to a chroot directory.
+    """Base class for image creation.
 
-    ImageCreator is the simplest creator class available; it will install and
-    configure a system image according to the supplied kickstart file.
+    BaseImageCreator is the simplest creator class available; it will
+    create a system image according to the supplied kickstart file.
 
     e.g.
 
       import mic.imgcreate as imgcreate
       ks = imgcreate.read_kickstart("foo.ks")
       imgcreate.ImageCreator(ks, "foo").create()
-
     """
 
     def __del__(self):
         self.cleanup()
 
-    def __init__(self, createopts = None, pkgmgr = None):
+    def __init__(self, createopts = None):
         """Initialize an ImageCreator instance.
 
         ks -- a pykickstart.KickstartParser instance; this instance will be
@@ -59,36 +53,19 @@ class BaseImageCreator(object):
                 filesystem labels
         """
 
-        self.pkgmgr = pkgmgr
-
         self.__builddir = None
-        self.__bindmounts = []
 
         self.ks = None
         self.name = "target"
         self.tmpdir = "/var/tmp/wic"
-        self.cachedir = "/var/tmp/wic/cache"
         self.workdir = "/var/tmp/wic/build"
 
-        self.destdir = "."
-        self.installerfw_prefix = "INSTALLERFW_"
-        self.target_arch = "noarch"
-        self._local_pkgs_path = None
-        self.pack_to = None
-        self.repourl = {}
-
-        # If the kernel is save to the destdir when copy_kernel cmd is called.
-        self._need_copy_kernel = False
         # setup tmpfs tmpdir when enabletmpfs is True
         self.enabletmpfs = False
 
         if createopts:
             # Mapping table for variables that have different names.
-            optmap = {"pkgmgr" : "pkgmgr_name",
-                      "outdir" : "destdir",
-                      "arch" : "target_arch",
-                      "local_pkgs_path" : "_local_pkgs_path",
-                      "copy_kernel" : "_need_copy_kernel",
+            optmap = {"outdir" : "destdir",
                      }
 
             # update setting from createopts
@@ -101,41 +78,11 @@ class BaseImageCreator(object):
 
             self.destdir = os.path.abspath(os.path.expanduser(self.destdir))
 
-            if 'release' in createopts and createopts['release']:
-                self.name = createopts['release'] + '_' + self.name
-
-            if self.pack_to:
-                if '@NAME@' in self.pack_to:
-                    self.pack_to = self.pack_to.replace('@NAME@', self.name)
-                (tar, ext) = os.path.splitext(self.pack_to)
-                if ext in (".gz", ".bz2") and tar.endswith(".tar"):
-                    ext = ".tar" + ext
-                if ext not in misc.pack_formats:
-                    self.pack_to += ".tar"
-
-        self._dep_checks = ["ls", "bash", "cp", "echo", "modprobe"]
+        self._dep_checks = ["ls", "bash", "cp", "echo"]
 
         # Output image file names
         self.outimage = []
 
-        # A flag to generate checksum
-        self._genchecksum = False
-
-        self._alt_initrd_name = None
-
-        self._recording_pkgs = []
-
-        # available size in root fs, init to 0
-        self._root_fs_avail = 0
-
-        # Name of the disk image file that is created.
-        self._img_name = None
-
-        self.image_format = None
-
-        # Save qemu emulator file name in order to clean up it finally
-        self.qemu_emulator = None
-
         # No ks provided when called by convertor, so skip the dependency check
         if self.ks:
             # If we have btrfs partition we need to check necessary tools
@@ -144,31 +91,9 @@ class BaseImageCreator(object):
                     self._dep_checks.append("mkfs.btrfs")
                     break
 
-        if self.target_arch and self.target_arch.startswith("arm"):
-            for dep in self._dep_checks:
-                if dep == "extlinux":
-                    self._dep_checks.remove(dep)
-
-            if not os.path.exists("/usr/bin/qemu-arm") or \
-               not misc.is_statically_linked("/usr/bin/qemu-arm"):
-                self._dep_checks.append("qemu-arm-static")
-
-            if os.path.exists("/proc/sys/vm/vdso_enabled"):
-                vdso_fh = open("/proc/sys/vm/vdso_enabled","r")
-                vdso_value = vdso_fh.read().strip()
-                vdso_fh.close()
-                if (int)(vdso_value) == 1:
-                    msger.warning("vdso is enabled on your host, which might "
-                        "cause problems with arm emulations.\n"
-                        "\tYou can disable vdso with following command before "
-                        "starting image build:\n"
-                        "\techo 0 | sudo tee /proc/sys/vm/vdso_enabled")
-
         # make sure the specified tmpdir and cachedir exist
         if not os.path.exists(self.tmpdir):
             os.makedirs(self.tmpdir)
-        if not os.path.exists(self.cachedir):
-            os.makedirs(self.cachedir)
 
 
     #
@@ -190,23 +115,6 @@ class BaseImageCreator(object):
 
     """
 
-    def __get_outdir(self):
-        if self.__builddir is None:
-            raise CreatorError("_outdir is not valid before calling mount()")
-        return self.__builddir + "/out"
-    _outdir = property(__get_outdir)
-    """The staging location for the final image.
-
-    This is where subclasses should stage any files that are part of the final
-    image. ImageCreator.package() will copy any files found here into the
-    requested destination directory.
-
-    Note, this directory does not exist before ImageCreator.mount() is called.
-
-    Note also, this is a read-only attribute.
-
-    """
-
 
     #
     # Hooks for subclasses
@@ -239,408 +147,6 @@ class BaseImageCreator(object):
         """
         pass
 
-    def _create_bootconfig(self):
-        """Configure the image so that it's bootable.
-
-        This is the hook where subclasses may prepare the image for booting by
-        e.g. creating an initramfs and bootloader configuration.
-
-        This hook is called while the install root is still mounted, after the
-        packages have been installed and the kickstart configuration has been
-        applied, but before the %post scripts have been executed.
-
-        There is no default implementation.
-
-        """
-        pass
-
-    def _stage_final_image(self):
-        """Stage the final system image in _outdir.
-
-        This is the hook where subclasses should place the image in _outdir
-        so that package() can copy it to the requested destination directory.
-
-        By default, this moves the install root into _outdir.
-
-        """
-        shutil.move(self._instroot, self._outdir + "/" + self.name)
-
-    def get_installed_packages(self):
-        return self._pkgs_content.keys()
-
-    def _save_recording_pkgs(self, destdir):
-        """Save the list or content of installed packages to file.
-        """
-        pkgs = self._pkgs_content.keys()
-        pkgs.sort() # inplace op
-
-        if not os.path.exists(destdir):
-            os.makedirs(destdir)
-
-        content = None
-        if 'vcs' in self._recording_pkgs:
-            vcslst = ["%s %s" % (k, v) for (k, v) in self._pkgs_vcsinfo.items()]
-            content = '\n'.join(sorted(vcslst))
-        elif 'name' in self._recording_pkgs:
-            content = '\n'.join(pkgs)
-        if content:
-            namefile = os.path.join(destdir, self.name + '.packages')
-            f = open(namefile, "w")
-            f.write(content)
-            f.close()
-            self.outimage.append(namefile);
-
-        # if 'content', save more details
-        if 'content' in self._recording_pkgs:
-            contfile = os.path.join(destdir, self.name + '.files')
-            f = open(contfile, "w")
-
-            for pkg in pkgs:
-                content = pkg + '\n'
-
-                pkgcont = self._pkgs_content[pkg]
-                content += '    '
-                content += '\n    '.join(pkgcont)
-                content += '\n'
-
-                content += '\n'
-                f.write(content)
-            f.close()
-            self.outimage.append(contfile)
-
-        if 'license' in self._recording_pkgs:
-            licensefile = os.path.join(destdir, self.name + '.license')
-            f = open(licensefile, "w")
-
-            f.write('Summary:\n')
-            for license in reversed(sorted(self._pkgs_license, key=\
-                            lambda license: len(self._pkgs_license[license]))):
-                f.write("    - %s: %s\n" \
-                        % (license, len(self._pkgs_license[license])))
-
-            f.write('\nDetails:\n')
-            for license in reversed(sorted(self._pkgs_license, key=\
-                            lambda license: len(self._pkgs_license[license]))):
-                f.write("    - %s:\n" % (license))
-                for pkg in sorted(self._pkgs_license[license]):
-                    f.write("        - %s\n" % (pkg))
-                f.write('\n')
-
-            f.close()
-            self.outimage.append(licensefile)
-
-    def _get_required_packages(self):
-        """Return a list of required packages.
-
-        This is the hook where subclasses may specify a set of packages which
-        it requires to be installed.
-
-        This returns an empty list by default.
-
-        Note, subclasses should usually chain up to the base class
-        implementation of this hook.
-
-        """
-        return []
-
-    def _get_excluded_packages(self):
-        """Return a list of excluded packages.
-
-        This is the hook where subclasses may specify a set of packages which
-        it requires _not_ to be installed.
-
-        This returns an empty list by default.
-
-        Note, subclasses should usually chain up to the base class
-        implementation of this hook.
-
-        """
-        return []
-
-    def _get_local_packages(self):
-        """Return a list of rpm path to be local installed.
-
-        This is the hook where subclasses may specify a set of rpms which
-        it requires to be installed locally.
-
-        This returns an empty list by default.
-
-        Note, subclasses should usually chain up to the base class
-        implementation of this hook.
-
-        """
-        if self._local_pkgs_path:
-            if os.path.isdir(self._local_pkgs_path):
-                return glob.glob(
-                        os.path.join(self._local_pkgs_path, '*.rpm'))
-            elif os.path.splitext(self._local_pkgs_path)[-1] == '.rpm':
-                return [self._local_pkgs_path]
-
-        return []
-
-    def _get_fstab(self):
-        """Return the desired contents of /etc/fstab.
-
-        This is the hook where subclasses may specify the contents of
-        /etc/fstab by returning a string containing the desired contents.
-
-        A sensible default implementation is provided.
-
-        """
-        s =  "/dev/root  /         %s    %s 0 0\n" \
-             % (self._fstype,
-                "defaults,noatime" if not self._fsopts else self._fsopts)
-        s += self._get_fstab_special()
-        return s
-
-    def _get_fstab_special(self):
-        s = "devpts     /dev/pts  devpts  gid=5,mode=620   0 0\n"
-        s += "tmpfs      /dev/shm  tmpfs   defaults         0 0\n"
-        s += "proc       /proc     proc    defaults         0 0\n"
-        s += "sysfs      /sys      sysfs   defaults         0 0\n"
-        return s
-
-    def _set_part_env(self, pnum, prop, value):
-        """ This is a helper function which generates an environment variable
-        for a property "prop" with value "value" of a partition number "pnum".
-
-        The naming convention is:
-           * Variables start with INSTALLERFW_PART
-           * Then goes the partition number, the order is the same as
-             specified in the KS file
-           * Then goes the property name
-        """
-
-        if value == None:
-            value = ""
-        else:
-            value = str(value)
-
-        name = self.installerfw_prefix + ("PART%d_" % pnum) + prop
-        return { name : value }
-
-    def _get_post_scripts_env(self, in_chroot):
-        """Return an environment dict for %post scripts.
-
-        This is the hook where subclasses may specify some environment
-        variables for %post scripts by return a dict containing the desired
-        environment.
-
-        in_chroot -- whether this %post script is to be executed chroot()ed
-                     into _instroot.
-        """
-
-        env = {}
-        pnum = 0
-
-        for p in kickstart.get_partitions(self.ks):
-            env.update(self._set_part_env(pnum, "SIZE", p.size))
-            env.update(self._set_part_env(pnum, "MOUNTPOINT", p.mountpoint))
-            env.update(self._set_part_env(pnum, "FSTYPE", p.fstype))
-            env.update(self._set_part_env(pnum, "LABEL", p.label))
-            env.update(self._set_part_env(pnum, "FSOPTS", p.fsopts))
-            env.update(self._set_part_env(pnum, "BOOTFLAG", p.active))
-            env.update(self._set_part_env(pnum, "ALIGN", p.align))
-            env.update(self._set_part_env(pnum, "TYPE_ID", p.part_type))
-            env.update(self._set_part_env(pnum, "DEVNODE",
-                                          "/dev/%s%d" % (p.disk, pnum + 1)))
-            pnum += 1
-
-        # Count of paritions
-        env[self.installerfw_prefix + "PART_COUNT"] = str(pnum)
-
-        # Partition table format
-        ptable_format = self.ks.handler.bootloader.ptable
-        env[self.installerfw_prefix + "PTABLE_FORMAT"] = ptable_format
-
-        # The kerned boot parameters
-        kernel_opts = self.ks.handler.bootloader.appendLine
-        env[self.installerfw_prefix + "KERNEL_OPTS"] = kernel_opts
-
-        # Name of the distribution
-        env[self.installerfw_prefix + "DISTRO_NAME"] = self.distro_name
-
-        # Name of the image creation tool
-        env[self.installerfw_prefix + "INSTALLER_NAME"] = "wic"
-
-        # The real current location of the mounted file-systems
-        if in_chroot:
-            mount_prefix = "/"
-        else:
-            mount_prefix = self._instroot
-        env[self.installerfw_prefix + "MOUNT_PREFIX"] = mount_prefix
-
-        # These are historical variables which lack the common name prefix
-        if not in_chroot:
-            env["INSTALL_ROOT"] = self._instroot
-            env["IMG_NAME"] = self._name
-
-        return env
-
-    def __get_imgname(self):
-        return self.name
-    _name = property(__get_imgname)
-    """The name of the image file.
-
-    """
-
-    def _get_kernel_versions(self):
-        """Return a dict detailing the available kernel types/versions.
-
-        This is the hook where subclasses may override what kernel types and
-        versions should be available for e.g. creating the booloader
-        configuration.
-
-        A dict should be returned mapping the available kernel types to a list
-        of the available versions for those kernels.
-
-        The default implementation uses rpm to iterate over everything
-        providing 'kernel', finds /boot/vmlinuz-* and returns the version
-        obtained from the vmlinuz filename. (This can differ from the kernel
-        RPM's n-v-r in the case of e.g. xen)
-
-        """
-        def get_kernel_versions(instroot):
-            ret = {}
-            versions = set()
-            files = glob.glob(instroot + "/boot/vmlinuz-*")
-            for file in files:
-                version = os.path.basename(file)[8:]
-                if version is None:
-                    continue
-                versions.add(version)
-            ret["kernel"] = list(versions)
-            return ret
-
-        def get_version(header):
-            version = None
-            for f in header['filenames']:
-                if f.startswith('/boot/vmlinuz-'):
-                    version = f[14:]
-            return version
-
-        if self.ks is None:
-            return get_kernel_versions(self._instroot)
-
-        ts = rpm.TransactionSet(self._instroot)
-
-        ret = {}
-        for header in ts.dbMatch('provides', 'kernel'):
-            version = get_version(header)
-            if version is None:
-                continue
-
-            name = header['name']
-            if not name in ret:
-                ret[name] = [version]
-            elif not version in ret[name]:
-                ret[name].append(version)
-
-        return ret
-
-
-    #
-    # Helpers for subclasses
-    #
-    def _do_bindmounts(self):
-        """Mount various system directories onto _instroot.
-
-        This method is called by mount(), but may also be used by subclasses
-        in order to re-mount the bindmounts after modifying the underlying
-        filesystem.
-
-        """
-        for b in self.__bindmounts:
-            b.mount()
-
-    def _undo_bindmounts(self):
-        """Unmount the bind-mounted system directories from _instroot.
-
-        This method is usually only called by unmount(), but may also be used
-        by subclasses in order to gain access to the filesystem obscured by
-        the bindmounts - e.g. in order to create device nodes on the image
-        filesystem.
-
-        """
-        self.__bindmounts.reverse()
-        for b in self.__bindmounts:
-            b.unmount()
-
-    def _chroot(self):
-        """Chroot into the install root.
-
-        This method may be used by subclasses when executing programs inside
-        the install root e.g.
-
-          subprocess.call(["/bin/ls"], preexec_fn = self.chroot)
-
-        """
-        os.chroot(self._instroot)
-        os.chdir("/")
-
-    def _mkdtemp(self, prefix = "tmp-"):
-        """Create a temporary directory.
-
-        This method may be used by subclasses to create a temporary directory
-        for use in building the final image - e.g. a subclass might create
-        a temporary directory in order to bundle a set of files into a package.
-
-        The subclass may delete this directory if it wishes, but it will be
-        automatically deleted by cleanup().
-
-        The absolute path to the temporary directory is returned.
-
-        Note, this method should only be called after mount() has been called.
-
-        prefix -- a prefix which should be used when creating the directory;
-                  defaults to "tmp-".
-
-        """
-        self.__ensure_builddir()
-        return tempfile.mkdtemp(dir = self.__builddir, prefix = prefix)
-
-    def _mkstemp(self, prefix = "tmp-"):
-        """Create a temporary file.
-
-        This method may be used by subclasses to create a temporary file
-        for use in building the final image - e.g. a subclass might need
-        a temporary location to unpack a compressed file.
-
-        The subclass may delete this file if it wishes, but it will be
-        automatically deleted by cleanup().
-
-        A tuple containing a file descriptor (returned from os.open() and the
-        absolute path to the temporary directory is returned.
-
-        Note, this method should only be called after mount() has been called.
-
-        prefix -- a prefix which should be used when creating the file;
-                  defaults to "tmp-".
-
-        """
-        self.__ensure_builddir()
-        return tempfile.mkstemp(dir = self.__builddir, prefix = prefix)
-
-    def _mktemp(self, prefix = "tmp-"):
-        """Create a temporary file.
-
-        This method simply calls _mkstemp() and closes the returned file
-        descriptor.
-
-        The absolute path to the temporary file is returned.
-
-        Note, this method should only be called after mount() has been called.
-
-        prefix -- a prefix which should be used when creating the file;
-                  defaults to "tmp-".
-
-        """
-
-        (f, path) = self._mkstemp(prefix)
-        os.close(f)
-        return path
-
-
     #
     # Actual implementation
     #
@@ -658,64 +164,6 @@ class BaseImageCreator(object):
             raise CreatorError("Failed create build directory in %s: %s" %
                                (self.tmpdir, msg))
 
-    def get_cachedir(self, cachedir = None):
-        if self.cachedir:
-            return self.cachedir
-
-        self.__ensure_builddir()
-        if cachedir:
-            self.cachedir = cachedir
-        else:
-            self.cachedir = self.__builddir + "/wic-cache"
-        fs.makedirs(self.cachedir)
-        return self.cachedir
-
-    def __sanity_check(self):
-        """Ensure that the config we've been given is sane."""
-        if not (kickstart.get_packages(self.ks) or
-                kickstart.get_groups(self.ks)):
-            raise CreatorError("No packages or groups specified")
-
-        kickstart.convert_method_to_repo(self.ks)
-
-        if not kickstart.get_repos(self.ks):
-            raise CreatorError("No repositories specified")
-
-    def __write_fstab(self):
-        fstab_contents = self._get_fstab()
-        if fstab_contents:
-            fstab = open(self._instroot + "/etc/fstab", "w")
-            fstab.write(fstab_contents)
-            fstab.close()
-
-    def __create_minimal_dev(self):
-        """Create a minimal /dev so that we don't corrupt the host /dev"""
-        origumask = os.umask(0000)
-        devices = (('null',   1, 3, 0666),
-                   ('urandom',1, 9, 0666),
-                   ('random', 1, 8, 0666),
-                   ('full',   1, 7, 0666),
-                   ('ptmx',   5, 2, 0666),
-                   ('tty',    5, 0, 0666),
-                   ('zero',   1, 5, 0666))
-
-        links = (("/proc/self/fd", "/dev/fd"),
-                 ("/proc/self/fd/0", "/dev/stdin"),
-                 ("/proc/self/fd/1", "/dev/stdout"),
-                 ("/proc/self/fd/2", "/dev/stderr"))
-
-        for (node, major, minor, perm) in devices:
-            if not os.path.exists(self._instroot + "/dev/" + node):
-                os.mknod(self._instroot + "/dev/" + node,
-                         perm | stat.S_IFCHR,
-                         os.makedev(major,minor))
-
-        for (src, dest) in links:
-            if not os.path.exists(self._instroot + dest):
-                os.symlink(src, self._instroot + dest)
-
-        os.umask(origumask)
-
     def __setup_tmpdir(self):
         if not self.enabletmpfs:
             return
@@ -789,338 +237,6 @@ class BaseImageCreator(object):
 
         self.__clean_tmpdir()
 
-    def __is_excluded_pkg(self, pkg):
-        if pkg in self._excluded_pkgs:
-            self._excluded_pkgs.remove(pkg)
-            return True
-
-        for xpkg in self._excluded_pkgs:
-            if xpkg.endswith('*'):
-                if pkg.startswith(xpkg[:-1]):
-                    return True
-            elif xpkg.startswith('*'):
-                if pkg.endswith(xpkg[1:]):
-                    return True
-
-        return None
-
-    def __select_packages(self, pkg_manager):
-        skipped_pkgs = []
-        for pkg in self._required_pkgs:
-            e = pkg_manager.selectPackage(pkg)
-            if e:
-                if kickstart.ignore_missing(self.ks):
-                    skipped_pkgs.append(pkg)
-                elif self.__is_excluded_pkg(pkg):
-                    skipped_pkgs.append(pkg)
-                else:
-                    raise CreatorError("Failed to find package '%s' : %s" %
-                                       (pkg, e))
-
-        for pkg in skipped_pkgs:
-            msger.warning("Skipping missing package '%s'" % (pkg,))
-
-    def __select_groups(self, pkg_manager):
-        skipped_groups = []
-        for group in self._required_groups:
-            e = pkg_manager.selectGroup(group.name, group.include)
-            if e:
-                if kickstart.ignore_missing(self.ks):
-                    skipped_groups.append(group)
-                else:
-                    raise CreatorError("Failed to find group '%s' : %s" %
-                                       (group.name, e))
-
-        for group in skipped_groups:
-            msger.warning("Skipping missing group '%s'" % (group.name,))
-
-    def __deselect_packages(self, pkg_manager):
-        for pkg in self._excluded_pkgs:
-            pkg_manager.deselectPackage(pkg)
-
-    def __localinst_packages(self, pkg_manager):
-        for rpm_path in self._get_local_packages():
-            pkg_manager.installLocal(rpm_path)
-
-    def __preinstall_packages(self, pkg_manager):
-        if not self.ks:
-            return
-
-        self._preinstall_pkgs = kickstart.get_pre_packages(self.ks)
-        for pkg in self._preinstall_pkgs:
-            pkg_manager.preInstall(pkg)
-
-    def __attachment_packages(self, pkg_manager):
-        if not self.ks:
-            return
-
-        self._attachment = []
-        for item in kickstart.get_attachment(self.ks):
-            if item.startswith('/'):
-                fpaths = os.path.join(self._instroot, item.lstrip('/'))
-                for fpath in glob.glob(fpaths):
-                    self._attachment.append(fpath)
-                continue
-
-            filelist = pkg_manager.getFilelist(item)
-            if filelist:
-                # found rpm in rootfs
-                for pfile in pkg_manager.getFilelist(item):
-                    fpath = os.path.join(self._instroot, pfile.lstrip('/'))
-                    self._attachment.append(fpath)
-                continue
-
-            # try to retrieve rpm file
-            (url, proxies) = pkg_manager.package_url(item)
-            if not url:
-                msger.warning("Can't get url from repo for %s" % item)
-                continue
-            fpath = os.path.join(self.cachedir, os.path.basename(url))
-            if not os.path.exists(fpath):
-                # download pkgs
-                try:
-                    fpath = grabber.myurlgrab(url, fpath, proxies, None)
-                except CreatorError:
-                    raise
-
-            tmpdir = self._mkdtemp()
-            misc.extract_rpm(fpath, tmpdir)
-            for (root, dirs, files) in os.walk(tmpdir):
-                for fname in files:
-                    fpath = os.path.join(root, fname)
-                    self._attachment.append(fpath)
-
-    def install(self, repo_urls=None):
-        """Install packages into the install root.
-
-        This function installs the packages listed in the supplied kickstart
-        into the install root. By default, the packages are installed from the
-        repository URLs specified in the kickstart.
-
-        repo_urls -- a dict which maps a repository name to a repository URL;
-                     if supplied, this causes any repository URLs specified in
-                     the kickstart to be overridden.
-
-        """
-
-        # initialize pkg list to install
-        if self.ks:
-            self.__sanity_check()
-
-            self._required_pkgs = \
-                kickstart.get_packages(self.ks, self._get_required_packages())
-            self._excluded_pkgs = \
-                kickstart.get_excluded(self.ks, self._get_excluded_packages())
-            self._required_groups = kickstart.get_groups(self.ks)
-        else:
-            self._required_pkgs = None
-            self._excluded_pkgs = None
-            self._required_groups = None
-
-        pkg_manager = self.get_pkg_manager()
-        pkg_manager.setup()
-
-        if hasattr(self, 'install_pkgs') and self.install_pkgs:
-            if 'debuginfo' in self.install_pkgs:
-                pkg_manager.install_debuginfo = True
-
-        for repo in kickstart.get_repos(self.ks, repo_urls):
-            (name, baseurl, mirrorlist, inc, exc,
-             proxy, proxy_username, proxy_password, debuginfo,
-             source, gpgkey, disable, ssl_verify, nocache,
-             cost, priority) = repo
-
-            yr = pkg_manager.addRepository(name, baseurl, mirrorlist, proxy,
-                        proxy_username, proxy_password, inc, exc, ssl_verify,
-                        nocache, cost, priority)
-
-        if kickstart.exclude_docs(self.ks):
-            rpm.addMacro("_excludedocs", "1")
-        rpm.addMacro("_dbpath", "/var/lib/rpm")
-        rpm.addMacro("__file_context_path", "%{nil}")
-        if kickstart.inst_langs(self.ks) != None:
-            rpm.addMacro("_install_langs", kickstart.inst_langs(self.ks))
-
-        try:
-            self.__preinstall_packages(pkg_manager)
-            self.__select_packages(pkg_manager)
-            self.__select_groups(pkg_manager)
-            self.__deselect_packages(pkg_manager)
-            self.__localinst_packages(pkg_manager)
-
-            BOOT_SAFEGUARD = 256L * 1024 * 1024 # 256M
-            checksize = self._root_fs_avail
-            if checksize:
-                checksize -= BOOT_SAFEGUARD
-            if self.target_arch:
-                pkg_manager._add_prob_flags(rpm.RPMPROB_FILTER_IGNOREARCH)
-            pkg_manager.runInstall(checksize)
-        except CreatorError, e:
-            raise
-        except  KeyboardInterrupt:
-            raise
-        else:
-            self._pkgs_content = pkg_manager.getAllContent()
-            self._pkgs_license = pkg_manager.getPkgsLicense()
-            self._pkgs_vcsinfo = pkg_manager.getVcsInfo()
-            self.__attachment_packages(pkg_manager)
-        finally:
-            pkg_manager.close()
-
-        # hook post install
-        self.postinstall()
-
-        # do some clean up to avoid lvm info leakage.  this sucks.
-        for subdir in ("cache", "backup", "archive"):
-            lvmdir = self._instroot + "/etc/lvm/" + subdir
-            try:
-                for f in os.listdir(lvmdir):
-                    os.unlink(lvmdir + "/" + f)
-            except:
-                pass
-
-    def postinstall(self):
-        self.copy_attachment()
-
-    def __run_post_scripts(self):
-        msger.info("Running scripts ...")
-        if os.path.exists(self._instroot + "/tmp"):
-            shutil.rmtree(self._instroot + "/tmp")
-        os.mkdir (self._instroot + "/tmp", 0755)
-        for s in kickstart.get_post_scripts(self.ks):
-            (fd, path) = tempfile.mkstemp(prefix = "ks-script-",
-                                          dir = self._instroot + "/tmp")
-
-            s.script = s.script.replace("\r", "")
-            os.write(fd, s.script)
-            os.close(fd)
-            os.chmod(path, 0700)
-
-            env = self._get_post_scripts_env(s.inChroot)
-
-            if not s.inChroot:
-                preexec = None
-                script = path
-            else:
-                preexec = self._chroot
-                script = "/tmp/" + os.path.basename(path)
-
-            try:
-                try:
-                    subprocess.call([s.interp, script],
-                                    preexec_fn = preexec,
-                                    env = env,
-                                    stdout = sys.stdout,
-                                    stderr = sys.stderr)
-                except OSError, (err, msg):
-                    raise CreatorError("Failed to execute %%post script "
-                                       "with '%s' : %s" % (s.interp, msg))
-            finally:
-                os.unlink(path)
-
-    def __save_repo_keys(self, repodata):
-        if not repodata:
-            return None
-
-        gpgkeydir = "/etc/pki/rpm-gpg"
-        fs.makedirs(self._instroot + gpgkeydir)
-        for repo in repodata:
-            if repo["repokey"]:
-                repokey = gpgkeydir + "/RPM-GPG-KEY-%s" %  repo["name"]
-                shutil.copy(repo["repokey"], self._instroot + repokey)
-
-    def configure(self, repodata = None):
-        """Configure the system image according to the kickstart.
-
-        This method applies the (e.g. keyboard or network) configuration
-        specified in the kickstart and executes the kickstart %post scripts.
-
-        If necessary, it also prepares the image to be bootable by e.g.
-        creating an initrd and bootloader configuration.
-
-        """
-        ksh = self.ks.handler
-
-        msger.info('Applying configurations ...')
-        try:
-            kickstart.LanguageConfig(self._instroot).apply(ksh.lang)
-            kickstart.KeyboardConfig(self._instroot).apply(ksh.keyboard)
-            kickstart.TimezoneConfig(self._instroot).apply(ksh.timezone)
-            #kickstart.AuthConfig(self._instroot).apply(ksh.authconfig)
-            kickstart.FirewallConfig(self._instroot).apply(ksh.firewall)
-            kickstart.RootPasswordConfig(self._instroot).apply(ksh.rootpw)
-            kickstart.UserConfig(self._instroot).apply(ksh.user)
-            kickstart.ServicesConfig(self._instroot).apply(ksh.services)
-            kickstart.XConfig(self._instroot).apply(ksh.xconfig)
-            kickstart.NetworkConfig(self._instroot).apply(ksh.network)
-            kickstart.RPMMacroConfig(self._instroot).apply(self.ks)
-            kickstart.DesktopConfig(self._instroot).apply(ksh.desktop)
-            self.__save_repo_keys(repodata)
-            kickstart.MoblinRepoConfig(self._instroot).apply(ksh.repo, repodata, self.repourl)
-        except:
-            msger.warning("Failed to apply configuration to image")
-            raise
-
-        self._create_bootconfig()
-        self.__run_post_scripts()
-
-    def launch_shell(self, launch):
-        """Launch a shell in the install root.
-
-        This method is launches a bash shell chroot()ed in the install root;
-        this can be useful for debugging.
-
-        """
-        if launch:
-            msger.info("Launching shell. Exit to continue.")
-            subprocess.call(["/bin/bash"], preexec_fn = self._chroot)
-
-    def do_genchecksum(self, image_name):
-        if not self._genchecksum:
-            return
-
-        md5sum = misc.get_md5sum(image_name)
-        with open(image_name + ".md5sum", "w") as f:
-            f.write("%s %s" % (md5sum, os.path.basename(image_name)))
-        self.outimage.append(image_name+".md5sum")
-
-    def package(self, destdir = "."):
-        """Prepares the created image for final delivery.
-
-        In its simplest form, this method merely copies the install root to the
-        supplied destination directory; other subclasses may choose to package
-        the image by e.g. creating a bootable ISO containing the image and
-        bootloader configuration.
-
-        destdir -- the directory into which the final image should be moved;
-                   this defaults to the current directory.
-
-        """
-        self._stage_final_image()
-
-        if not os.path.exists(destdir):
-            fs.makedirs(destdir)
-
-        if self._recording_pkgs:
-            self._save_recording_pkgs(destdir)
-
-        # For image formats with two or multiple image files, it will be
-        # better to put them under a directory
-        if self.image_format in ("raw", "vmdk", "vdi", "nand", "mrstnand"):
-            destdir = os.path.join(destdir, "%s-%s" \
-                                            % (self.name, self.image_format))
-            msger.debug("creating destination dir: %s" % destdir)
-            fs.makedirs(destdir)
-
-        # Ensure all data is flushed to _outdir
-        runner.quiet('sync')
-
-        misc.check_space_pre_cp(self._outdir, destdir)
-        for f in os.listdir(self._outdir):
-            shutil.move(os.path.join(self._outdir, f),
-                        os.path.join(destdir, f))
-            self.outimage.append(os.path.join(destdir, f))
-            self.do_genchecksum(os.path.join(destdir, f))
 
     def print_outimage_info(self):
         msg = "The new image can be found here:\n"
@@ -1129,135 +245,3 @@ class BaseImageCreator(object):
             msg += '  %s\n' % os.path.abspath(file)
 
         msger.info(msg)
-
-    def check_depend_tools(self):
-        for tool in self._dep_checks:
-            fs.find_binary_path(tool)
-
-    def package_output(self, image_format, destdir = ".", package="none"):
-        if not package or package == "none":
-            return
-
-        destdir = os.path.abspath(os.path.expanduser(destdir))
-        (pkg, comp) = os.path.splitext(package)
-        if comp:
-            comp=comp.lstrip(".")
-
-        if pkg == "tar":
-            if comp:
-                dst = "%s/%s-%s.tar.%s" %\
-                      (destdir, self.name, image_format, comp)
-            else:
-                dst = "%s/%s-%s.tar" %\
-                      (destdir, self.name, image_format)
-
-            msger.info("creating %s" % dst)
-            tar = tarfile.open(dst, "w:" + comp)
-
-            for file in self.outimage:
-                msger.info("adding %s to %s" % (file, dst))
-                tar.add(file,
-                        arcname=os.path.join("%s-%s" \
-                                           % (self.name, image_format),
-                                              os.path.basename(file)))
-                if os.path.isdir(file):
-                    shutil.rmtree(file, ignore_errors = True)
-                else:
-                    os.remove(file)
-
-            tar.close()
-
-            '''All the file in outimage has been packaged into tar.* file'''
-            self.outimage = [dst]
-
-    def release_output(self, config, destdir, release):
-        """ Create release directory and files
-        """
-
-        def _rpath(fn):
-            """ release path """
-            return os.path.join(destdir, fn)
-
-        outimages = self.outimage
-
-        # new ks
-        new_kspath = _rpath(self.name+'.ks')
-        with open(config) as fr:
-            with open(new_kspath, "w") as wf:
-                # When building a release we want to make sure the .ks
-                # file generates the same build even when --release not used.
-                wf.write(fr.read().replace("@BUILD_ID@", release))
-        outimages.append(new_kspath)
-
-        # save log file, logfile is only available in creator attrs
-        if hasattr(self, 'logfile') and not self.logfile:
-            log_path = _rpath(self.name + ".log")
-            # touch the log file, else outimages will filter it out
-            with open(log_path, 'w') as wf:
-                wf.write('')
-            msger.set_logfile(log_path)
-            outimages.append(_rpath(self.name + ".log"))
-
-        # rename iso and usbimg
-        for f in os.listdir(destdir):
-            if f.endswith(".iso"):
-                newf = f[:-4] + '.img'
-            elif f.endswith(".usbimg"):
-                newf = f[:-7] + '.img'
-            else:
-                continue
-            os.rename(_rpath(f), _rpath(newf))
-            outimages.append(_rpath(newf))
-
-        # generate MD5SUMS
-        with open(_rpath("MD5SUMS"), "w") as wf:
-            for f in os.listdir(destdir):
-                if f == "MD5SUMS":
-                    continue
-
-                if os.path.isdir(os.path.join(destdir, f)):
-                    continue
-
-                md5sum = misc.get_md5sum(_rpath(f))
-                # There needs to be two spaces between the sum and
-                # filepath to match the syntax with md5sum.
-                # This way also md5sum -c MD5SUMS can be used by users
-                wf.write("%s *%s\n" % (md5sum, f))
-
-        outimages.append("%s/MD5SUMS" % destdir)
-
-        # Filter out the nonexist file
-        for fp in outimages[:]:
-            if not os.path.exists("%s" % fp):
-                outimages.remove(fp)
-
-    def copy_kernel(self):
-        """ Copy kernel files to the outimage directory.
-        NOTE: This needs to be called before unmounting the instroot.
-        """
-
-        if not self._need_copy_kernel:
-            return
-
-        if not os.path.exists(self.destdir):
-            os.makedirs(self.destdir)
-
-        for kernel in glob.glob("%s/boot/vmlinuz-*" % self._instroot):
-            kernelfilename = "%s/%s-%s" % (self.destdir,
-                                           self.name,
-                                           os.path.basename(kernel))
-            msger.info('copy kernel file %s as %s' % (os.path.basename(kernel),
-                                                      kernelfilename))
-            shutil.copy(kernel, kernelfilename)
-            self.outimage.append(kernelfilename)
-
-    def copy_attachment(self):
-        """ Subclass implement it to handle attachment files
-        NOTE: This needs to be called before unmounting the instroot.
-        """
-        pass
-
-    def get_pkg_manager(self):
-        return self.pkgmgr(target_arch = self.target_arch,
-                           instroot = self._instroot,
-                           cachedir = self.cachedir)
diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 7e2b63a..93f0cd9 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -54,14 +54,14 @@ class DirectImageCreator(BaseImageCreator):
 
     def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir,
                  kernel_dir, native_sysroot, hdddir, staging_data_dir,
-                 creatoropts=None, pkgmgr=None, compress_image=None,
+                 creatoropts=None, compress_image=None,
                  generate_bmap=None, fstab_entry="uuid"):
         """
         Initialize a DirectImageCreator instance.
 
         This method takes the same arguments as ImageCreator.__init__()
         """
-        BaseImageCreator.__init__(self, creatoropts, pkgmgr)
+        BaseImageCreator.__init__(self, creatoropts)
 
         self.__instimage = None
         self.__imgdir = None
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 20/35] wic: Clean up DirectImageCreator
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (18 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 19/35] wic: Clean up BaseImageCreator Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 21/35] wic: Clean up PartitionedMount Tom Zanussi
                   ` (14 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

Remove what wic doesn't use from DirectImageCreator.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/direct.py                | 8 +-------
 scripts/lib/mic/plugins/imager/direct_plugin.py | 5 +----
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 93f0cd9..92473b5 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -54,8 +54,7 @@ class DirectImageCreator(BaseImageCreator):
 
     def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir,
                  kernel_dir, native_sysroot, hdddir, staging_data_dir,
-                 creatoropts=None, compress_image=None,
-                 generate_bmap=None, fstab_entry="uuid"):
+                 creatoropts=None):
         """
         Initialize a DirectImageCreator instance.
 
@@ -64,19 +63,14 @@ class DirectImageCreator(BaseImageCreator):
         BaseImageCreator.__init__(self, creatoropts)
 
         self.__instimage = None
-        self.__imgdir = None
         self.__disks = {}
         self.__disk_format = "direct"
         self._disk_names = []
         self._ptable_format = self.ks.handler.bootloader.ptable
-        self.use_uuid = fstab_entry == "uuid"
-        self.compress_image = compress_image
-        self.bmap_needed = generate_bmap
 
         self.oe_builddir = oe_builddir
         if image_output_dir:
             self.tmpdir = image_output_dir
-            self.cachedir = "%s/cache" % image_output_dir
         self.rootfs_dir = rootfs_dir
         self.bootimg_dir = bootimg_dir
         self.kernel_dir = kernel_dir
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py
index d3a0ba7..877aaf6 100644
--- a/scripts/lib/mic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/mic/plugins/imager/direct_plugin.py
@@ -88,10 +88,7 @@ class DirectPlugin(ImagerPlugin):
                                             native_sysroot,
                                             hdddir,
                                             staging_data_dir,
-                                            creatoropts,
-                                            None,
-                                            None,
-                                            None)
+                                            creatoropts)
 
         try:
             creator.mount(None, creatoropts["cachedir"])
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 21/35] wic: Clean up PartitionedMount
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (19 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 20/35] wic: Clean up DirectImageCreator Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 22/35] wic: Clean up Creator Tom Zanussi
                   ` (13 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use a lot of ParitionedMount, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/partitionedfs.py | 355 +--------------------------------
 1 file changed, 2 insertions(+), 353 deletions(-)

diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index 0c4c9ec..ef92125 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -33,18 +33,13 @@ MBR_OVERHEAD = 1
 SECTOR_SIZE = 512
 
 class PartitionedMount(Mount):
-    def __init__(self, mountdir, skipformat = False):
+    def __init__(self, mountdir):
         Mount.__init__(self, mountdir)
         self.disks = {}
         self.partitions = []
-        self.subvolumes = []
-        self.mapped = False
         self.mountOrder = []
         self.unmountOrder = []
         self.parted = find_binary_path("parted")
-        self.btrfscmd=None
-        self.skipformat = skipformat
-        self.snapshot_created = self.skipformat
         # Size of a sector used in calculations
         self.sector_size = SECTOR_SIZE
         self._partitions_layed_out = False
@@ -62,7 +57,6 @@ class PartitionedMount(Mount):
 
         self.disks[disk_name] = \
                 { 'disk': None,     # Disk object
-                  'mapped': False,  # True if kpartx mapping exists
                   'numpart': 0,     # Number of allocate partitions
                   'partitions': [], # Indexes to self.partitions
                   'offset': 0,      # Offset of next partition (in sectors)
@@ -98,40 +92,8 @@ class PartitionedMount(Mount):
         # Converting MB to sectors for parted
         size = size * 1024 * 1024 / self.sector_size
 
-        # We need to handle subvolumes for btrfs
-        if fstype == "btrfs" and fsopts and fsopts.find("subvol=") != -1:
-            self.btrfscmd=find_binary_path("btrfs")
-            subvol = None
-            opts = fsopts.split(",")
-            for opt in opts:
-                if opt.find("subvol=") != -1:
-                    subvol = opt.replace("subvol=", "").strip()
-                    break
-            if not subvol:
-                raise MountError("No subvolume: %s" % fsopts)
-            self.subvolumes.append({'size': size, # In sectors
-                                    'mountpoint': mountpoint, # Mount relative to chroot
-                                    'fstype': fstype, # Filesystem type
-                                    'fsopts': fsopts, # Filesystem mount options
-                                    'disk_name': disk_name, # physical disk name holding partition
-                                    'device': None, # kpartx device node for partition
-                                    'mount': None, # Mount object
-                                    'subvol': subvol, # Subvolume name
-                                    'boot': boot, # Bootable flag
-                                    'mounted': False # Mount flag
-                                   })
-
         # We still need partition for "/" or non-subvolume
-        if mountpoint == "/" or not fsopts or fsopts.find("subvol=") == -1:
-            # Don't need subvolume for "/" because it will be set as default subvolume
-            if fsopts and fsopts.find("subvol=") != -1:
-                opts = fsopts.split(",")
-                for opt in opts:
-                    if opt.strip().startswith("subvol="):
-                        opts.remove(opt)
-                        break
-                fsopts = ",".join(opts)
-
+        if mountpoint == "/" or not fsopts:
             part = { 'ks_pnum' : ks_pnum, # Partition number in the KS file
                      'size': size, # In sectors
                      'mountpoint': mountpoint, # Mount relative to chroot
@@ -283,10 +245,6 @@ class PartitionedMount(Mount):
     def __format_disks(self):
         self.layout_partitions()
 
-        if self.skipformat:
-            msger.debug("Skipping disk format, because skipformat flag is set.")
-            return
-
         for dev in self.disks.keys():
             d = self.disks[dev]
             msger.debug("Initializing partition table for %s" % \
@@ -346,103 +304,6 @@ class PartitionedMount(Mount):
                     self.__run_parted(["-s", d['disk'].device, "set",
                                        "%d" % p['num'], "lba", "off"])
 
-
-    def __map_partitions(self):
-        """Load it if dm_snapshot isn't loaded. """
-        load_module("dm_snapshot")
-
-        for dev in self.disks.keys():
-            d = self.disks[dev]
-            if d['mapped']:
-                continue
-
-            msger.debug("Running kpartx on %s" % d['disk'].device )
-            rc, kpartxOutput = runner.runtool([self.kpartx, "-l", "-v", d['disk'].device])
-            kpartxOutput = kpartxOutput.splitlines()
-
-            if rc != 0:
-                raise MountError("Failed to query partition mapping for '%s'" %
-                                 d['disk'].device)
-
-            # Strip trailing blank and mask verbose output
-            i = 0
-            while i < len(kpartxOutput) and kpartxOutput[i][0:4] != "loop":
-                i = i + 1
-            kpartxOutput = kpartxOutput[i:]
-
-            # Make sure kpartx reported the right count of partitions
-            if len(kpartxOutput) != d['numpart']:
-                # If this disk has more than 3 partitions, then in case of MBR
-                # paritions there is an extended parition. Different versions
-                # of kpartx behave differently WRT the extended partition -
-                # some map it, some ignore it. This is why we do the below hack
-                # - if kpartx reported one more partition and the partition
-                # table type is "msdos" and the amount of partitions is more
-                # than 3, we just assume kpartx mapped the extended parition
-                # and we remove it.
-                if len(kpartxOutput) == d['numpart'] + 1 \
-                   and d['ptable_format'] == 'msdos' and len(kpartxOutput) > 3:
-                    kpartxOutput.pop(3)
-                else:
-                    raise MountError("Unexpected number of partitions from " \
-                                     "kpartx: %d != %d" % \
-                                        (len(kpartxOutput), d['numpart']))
-
-            for i in range(len(kpartxOutput)):
-                line = kpartxOutput[i]
-                newdev = line.split()[0]
-                mapperdev = "/dev/mapper/" + newdev
-                loopdev = d['disk'].device + newdev[-1]
-
-                msger.debug("Dev %s: %s -> %s" % (newdev, loopdev, mapperdev))
-                pnum = d['partitions'][i]
-                self.partitions[pnum]['device'] = loopdev
-
-                # grub's install wants partitions to be named
-                # to match their parent device + partition num
-                # kpartx doesn't work like this, so we add compat
-                # symlinks to point to /dev/mapper
-                if os.path.lexists(loopdev):
-                    os.unlink(loopdev)
-                os.symlink(mapperdev, loopdev)
-
-            msger.debug("Adding partx mapping for %s" % d['disk'].device)
-            rc = runner.show([self.kpartx, "-v", "-a", d['disk'].device])
-
-            if rc != 0:
-                # Make sure that the device maps are also removed on error case.
-                # The d['mapped'] isn't set to True if the kpartx fails so
-                # failed mapping will not be cleaned on cleanup either.
-                runner.quiet([self.kpartx, "-d", d['disk'].device])
-                raise MountError("Failed to map partitions for '%s'" %
-                                 d['disk'].device)
-
-            # FIXME: there is a bit delay for multipath device setup,
-            # wait 10ms for the setup
-            import time
-            time.sleep(10)
-            d['mapped'] = True
-
-    def __unmap_partitions(self):
-        for dev in self.disks.keys():
-            d = self.disks[dev]
-            if not d['mapped']:
-                continue
-
-            msger.debug("Removing compat symlinks")
-            for pnum in d['partitions']:
-                if self.partitions[pnum]['device'] != None:
-                    os.unlink(self.partitions[pnum]['device'])
-                    self.partitions[pnum]['device'] = None
-
-            msger.debug("Unmapping %s" % d['disk'].device)
-            rc = runner.quiet([self.kpartx, "-d", d['disk'].device])
-            if rc != 0:
-                raise MountError("Failed to unmap partitions for '%s'" %
-                                 d['disk'].device)
-
-            d['mapped'] = False
-
     def __calculate_mountorder(self):
         msger.debug("Calculating mount order")
         for p in self.partitions:
@@ -457,7 +318,6 @@ class PartitionedMount(Mount):
     def cleanup(self):
         Mount.cleanup(self)
         if self.disks:
-            self.__unmap_partitions()
             for dev in self.disks.keys():
                 d = self.disks[dev]
                 try:
@@ -466,7 +326,6 @@ class PartitionedMount(Mount):
                     pass
 
     def unmount(self):
-        self.__unmount_subvolumes()
         for mp in self.unmountOrder:
             if mp == 'swap':
                 continue
@@ -478,217 +337,11 @@ class PartitionedMount(Mount):
 
             if p['mount'] != None:
                 try:
-                    # Create subvolume snapshot here
-                    if p['fstype'] == "btrfs" and p['mountpoint'] == "/" and not self.snapshot_created:
-                        self.__create_subvolume_snapshots(p, p["mount"])
                     p['mount'].cleanup()
                 except:
                     pass
                 p['mount'] = None
 
-    # Only for btrfs
-    def __get_subvolume_id(self, rootpath, subvol):
-        if not self.btrfscmd:
-            self.btrfscmd=find_binary_path("btrfs")
-        argv = [ self.btrfscmd, "subvolume", "list", rootpath ]
-
-        rc, out = runner.runtool(argv)
-        msger.debug(out)
-
-        if rc != 0:
-            raise MountError("Failed to get subvolume id from %s', return code: %d." % (rootpath, rc))
-
-        subvolid = -1
-        for line in out.splitlines():
-            if line.endswith(" path %s" % subvol):
-                subvolid = line.split()[1]
-                if not subvolid.isdigit():
-                    raise MountError("Invalid subvolume id: %s" % subvolid)
-                subvolid = int(subvolid)
-                break
-        return subvolid
-
-    def __create_subvolume_metadata(self, p, pdisk):
-        if len(self.subvolumes) == 0:
-            return
-
-        argv = [ self.btrfscmd, "subvolume", "list", pdisk.mountdir ]
-        rc, out = runner.runtool(argv)
-        msger.debug(out)
-
-        if rc != 0:
-            raise MountError("Failed to get subvolume id from %s', return code: %d." % (pdisk.mountdir, rc))
-
-        subvolid_items = out.splitlines()
-        subvolume_metadata = ""
-        for subvol in self.subvolumes:
-            for line in subvolid_items:
-                if line.endswith(" path %s" % subvol["subvol"]):
-                    subvolid = line.split()[1]
-                    if not subvolid.isdigit():
-                        raise MountError("Invalid subvolume id: %s" % subvolid)
-
-                    subvolid = int(subvolid)
-                    opts = subvol["fsopts"].split(",")
-                    for opt in opts:
-                        if opt.strip().startswith("subvol="):
-                            opts.remove(opt)
-                            break
-                    fsopts = ",".join(opts)
-                    subvolume_metadata += "%d\t%s\t%s\t%s\n" % (subvolid, subvol["subvol"], subvol['mountpoint'], fsopts)
-
-        if subvolume_metadata:
-            fd = open("%s/.subvolume_metadata" % pdisk.mountdir, "w")
-            fd.write(subvolume_metadata)
-            fd.close()
-
-    def __get_subvolume_metadata(self, p, pdisk):
-        subvolume_metadata_file = "%s/.subvolume_metadata" % pdisk.mountdir
-        if not os.path.exists(subvolume_metadata_file):
-            return
-
-        fd = open(subvolume_metadata_file, "r")
-        content = fd.read()
-        fd.close()
-
-        for line in content.splitlines():
-            items = line.split("\t")
-            if items and len(items) == 4:
-                self.subvolumes.append({'size': 0, # In sectors
-                                        'mountpoint': items[2], # Mount relative to chroot
-                                        'fstype': "btrfs", # Filesystem type
-                                        'fsopts': items[3] + ",subvol=%s" %  items[1], # Filesystem mount options
-                                        'disk_name': p['disk_name'], # physical disk name holding partition
-                                        'device': None, # kpartx device node for partition
-                                        'mount': None, # Mount object
-                                        'subvol': items[1], # Subvolume name
-                                        'boot': False, # Bootable flag
-                                        'mounted': False # Mount flag
-                                   })
-
-    def __create_subvolumes(self, p, pdisk):
-        """ Create all the subvolumes. """
-
-        for subvol in self.subvolumes:
-            argv = [ self.btrfscmd, "subvolume", "create", pdisk.mountdir + "/" + subvol["subvol"]]
-
-            rc = runner.show(argv)
-            if rc != 0:
-                raise MountError("Failed to create subvolume '%s', return code: %d." % (subvol["subvol"], rc))
-
-        # Set default subvolume, subvolume for "/" is default
-        subvol = None
-        for subvolume in self.subvolumes:
-            if subvolume["mountpoint"] == "/" and p['disk_name'] == subvolume['disk_name']:
-                subvol = subvolume
-                break
-
-        if subvol:
-            # Get default subvolume id
-            subvolid = self. __get_subvolume_id(pdisk.mountdir, subvol["subvol"])
-            # Set default subvolume
-            if subvolid != -1:
-                rc = runner.show([ self.btrfscmd, "subvolume", "set-default", "%d" % subvolid, pdisk.mountdir])
-                if rc != 0:
-                    raise MountError("Failed to set default subvolume id: %d', return code: %d." % (subvolid, rc))
-
-        self.__create_subvolume_metadata(p, pdisk)
-
-    def __mount_subvolumes(self, p, pdisk):
-        if self.skipformat:
-            # Get subvolume info
-            self.__get_subvolume_metadata(p, pdisk)
-            # Set default mount options
-            if len(self.subvolumes) != 0:
-                for subvol in self.subvolumes:
-                    if subvol["mountpoint"] == p["mountpoint"] == "/":
-                        opts = subvol["fsopts"].split(",")
-                        for opt in opts:
-                            if opt.strip().startswith("subvol="):
-                                opts.remove(opt)
-                                break
-                        pdisk.fsopts = ",".join(opts)
-                        break
-
-        if len(self.subvolumes) == 0:
-            # Return directly if no subvolumes
-            return
-
-        # Remount to make default subvolume mounted
-        rc = runner.show([self.umountcmd, pdisk.mountdir])
-        if rc != 0:
-            raise MountError("Failed to umount %s" % pdisk.mountdir)
-
-        rc = runner.show([self.mountcmd, "-o", pdisk.fsopts, pdisk.disk.device, pdisk.mountdir])
-        if rc != 0:
-            raise MountError("Failed to umount %s" % pdisk.mountdir)
-
-        for subvol in self.subvolumes:
-            if subvol["mountpoint"] == "/":
-                continue
-            subvolid = self. __get_subvolume_id(pdisk.mountdir, subvol["subvol"])
-            if subvolid == -1:
-                msger.debug("WARNING: invalid subvolume %s" % subvol["subvol"])
-                continue
-            # Replace subvolume name with subvolume ID
-            opts = subvol["fsopts"].split(",")
-            for opt in opts:
-                if opt.strip().startswith("subvol="):
-                    opts.remove(opt)
-                    break
-
-            opts.extend(["subvolrootid=0", "subvol=%s" % subvol["subvol"]])
-            fsopts = ",".join(opts)
-            subvol['fsopts'] = fsopts
-            mountpoint = self.mountdir + subvol['mountpoint']
-            makedirs(mountpoint)
-            rc = runner.show([self.mountcmd, "-o", fsopts, pdisk.disk.device, mountpoint])
-            if rc != 0:
-                raise MountError("Failed to mount subvolume %s to %s" % (subvol["subvol"], mountpoint))
-            subvol["mounted"] = True
-
-    def __unmount_subvolumes(self):
-        """ It may be called multiple times, so we need to chekc if it is still mounted. """
-        for subvol in self.subvolumes:
-            if subvol["mountpoint"] == "/":
-                continue
-            if not subvol["mounted"]:
-                continue
-            mountpoint = self.mountdir + subvol['mountpoint']
-            rc = runner.show([self.umountcmd, mountpoint])
-            if rc != 0:
-                raise MountError("Failed to unmount subvolume %s from %s" % (subvol["subvol"], mountpoint))
-            subvol["mounted"] = False
-
-    def __create_subvolume_snapshots(self, p, pdisk):
-        import time
-
-        if self.snapshot_created:
-            return
-
-        # Remount with subvolid=0
-        rc = runner.show([self.umountcmd, pdisk.mountdir])
-        if rc != 0:
-            raise MountError("Failed to umount %s" % pdisk.mountdir)
-        if pdisk.fsopts:
-            mountopts = pdisk.fsopts + ",subvolid=0"
-        else:
-            mountopts = "subvolid=0"
-        rc = runner.show([self.mountcmd, "-o", mountopts, pdisk.disk.device, pdisk.mountdir])
-        if rc != 0:
-            raise MountError("Failed to umount %s" % pdisk.mountdir)
-
-        # Create all the subvolume snapshots
-        snapshotts = time.strftime("%Y%m%d-%H%M")
-        for subvol in self.subvolumes:
-            subvolpath = pdisk.mountdir + "/" + subvol["subvol"]
-            snapshotpath = subvolpath + "_%s-1" % snapshotts
-            rc = runner.show([ self.btrfscmd, "subvolume", "snapshot", subvolpath, snapshotpath ])
-            if rc != 0:
-                raise MountError("Failed to create subvolume snapshot '%s' for '%s', return code: %d." % (snapshotpath, subvolpath, rc))
-
-        self.snapshot_created = True
-
     def __install_partition(self, num, source_file, start, size):
         """
         Install source_file contents into a partition.
@@ -734,7 +387,3 @@ class PartitionedMount(Mount):
         self.__calculate_mountorder()
 
         return
-
-    def resparse(self, size = None):
-        # Can't re-sparse a disk image - too hard
-        pass
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 22/35] wic: Clean up Creator
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (20 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 21/35] wic: Clean up PartitionedMount Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 23/35] wic: Remove unused command versioning support Tom Zanussi
                   ` (12 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't use a lot of Creator, so remove it.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/creator.py | 176 ++-------------------------------------------
 1 file changed, 6 insertions(+), 170 deletions(-)

diff --git a/scripts/lib/mic/creator.py b/scripts/lib/mic/creator.py
index 267928f..7c9ca6f 100644
--- a/scripts/lib/mic/creator.py
+++ b/scripts/lib/mic/creator.py
@@ -44,7 +44,7 @@ class Creator(cmdln.Cmdln):
         # mix-in do_subcmd interface
         for subcmd, klass in pluginmgr.get_plugins('imager').iteritems():
             if not hasattr(klass, 'do_create'):
-                msger.warning("Unsurpport subcmd: %s" % subcmd)
+                msger.warning("Unsupported subcmd: %s" % subcmd)
                 continue
 
             func = getattr(klass, 'do_create')
@@ -65,59 +65,12 @@ class Creator(cmdln.Cmdln):
         optparser.add_option('-c', '--config', type='string', dest='config',
                              default=None,
                              help='Specify config file for mic')
-        optparser.add_option('-k', '--cachedir', type='string', action='store',
-                             dest='cachedir', default=None,
-                             help='Cache directory to store the downloaded')
         optparser.add_option('-o', '--outdir', type='string', action='store',
                              dest='outdir', default=None,
                              help='Output directory')
-        optparser.add_option('-A', '--arch', type='string', dest='arch',
-                             default=None,
-                             help='Specify repo architecture')
-        optparser.add_option('', '--release', type='string', dest='release',
-                             default=None, metavar='RID',
-                             help='Generate a release of RID with all necessary'
-                                  ' files, when @BUILD_ID@ is contained in '
-                                  'kickstart file, it will be replaced by RID')
-        optparser.add_option("", "--record-pkgs", type="string",
-                             dest="record_pkgs", default=None,
-                             help='Record the info of installed packages, '
-                                  'multiple values can be specified which '
-                                  'joined by ",", valid values: "name", '
-                                  '"content", "license", "vcs"')
-        optparser.add_option('', '--pkgmgr', type='string', dest='pkgmgr',
-                             default=None,
-                             help='Specify backend package manager')
-        optparser.add_option('', '--local-pkgs-path', type='string',
-                             dest='local_pkgs_path', default=None,
-                             help='Path for local pkgs(rpms) to be installed')
-        optparser.add_option('', '--runtime', type='string',
-                             dest='runtime', default=None,
-                             help='Specify  runtime mode, avaiable: bootstrap, native')
-        # --taring-to is alias to --pack-to
-        optparser.add_option('', '--taring-to', type='string',
-                             dest='pack_to', default=None,
-                             help=SUPPRESS_HELP)
-        optparser.add_option('', '--pack-to', type='string',
-                             dest='pack_to', default=None,
-                             help='Pack the images together into the specified'
-                                  ' achive, extension supported: .zip, .tar, '
-                                  '.tar.gz, .tar.bz2, etc. by default, .tar '
-                                  'will be used')
-        optparser.add_option('', '--copy-kernel', action='store_true',
-                             dest='copy_kernel',
-                             help='Copy kernel files from image /boot directory'
-                                  ' to the image output directory.')
-        optparser.add_option('', '--install-pkgs', type='string', action='store',
-                             dest='install_pkgs', default=None,
-                             help='Specify what type of packages to be installed,'
-                                  ' valid: source, debuginfo, debugsource')
         optparser.add_option('', '--tmpfs', action='store_true', dest='enabletmpfs',
                              help='Setup tmpdir as tmpfs to accelerate, experimental'
                                   ' feature, use it if you have more than 4G memory')
-        optparser.add_option('', '--repourl', action='append',
-                             dest='repourl', default=[],
-                             help=SUPPRESS_HELP)
         return optparser
 
     def preoptparse(self, argv):
@@ -183,78 +136,16 @@ class Creator(cmdln.Cmdln):
 
         if self.options.outdir is not None:
             configmgr.create['outdir'] = abspath(self.options.outdir)
-        if self.options.cachedir is not None:
-            configmgr.create['cachedir'] = abspath(self.options.cachedir)
-        os.environ['ZYPP_LOCKFILE_ROOT'] = configmgr.create['cachedir']
-
-        for cdir in ('outdir', 'cachedir'):
-            if os.path.exists(configmgr.create[cdir]) \
-              and not os.path.isdir(configmgr.create[cdir]):
-                msger.error('Invalid directory specified: %s' \
-                            % configmgr.create[cdir])
-
-        if self.options.local_pkgs_path is not None:
-            if not os.path.exists(self.options.local_pkgs_path):
-                msger.error('Local pkgs directory: \'%s\' not exist' \
-                              % self.options.local_pkgs_path)
-            configmgr.create['local_pkgs_path'] = self.options.local_pkgs_path
-
-        if self.options.release:
-            configmgr.create['release'] = self.options.release.rstrip('/')
-
-        if self.options.record_pkgs:
-            configmgr.create['record_pkgs'] = []
-            for infotype in self.options.record_pkgs.split(','):
-                if infotype not in ('name', 'content', 'license', 'vcs'):
-                    raise errors.Usage('Invalid pkg recording: %s, valid ones:'
-                                       ' "name", "content", "license", "vcs"' \
-                                       % infotype)
-
-                configmgr.create['record_pkgs'].append(infotype)
-
-        if self.options.arch is not None:
-            supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
-            if self.options.arch in supported_arch:
-                configmgr.create['arch'] = self.options.arch
-            else:
-                raise errors.Usage('Invalid architecture: "%s".\n'
-                                   '  Supported architectures are: \n'
-                                   '  %s' % (self.options.arch,
-                                               ', '.join(supported_arch)))
-
-        if self.options.pkgmgr is not None:
-            configmgr.create['pkgmgr'] = self.options.pkgmgr
 
-        if self.options.runtime:
-            configmgr.set_runtime(self.options.runtime)
-
-        if self.options.pack_to is not None:
-            configmgr.create['pack_to'] = self.options.pack_to
-
-        if self.options.copy_kernel:
-            configmgr.create['copy_kernel'] = self.options.copy_kernel
-
-        if self.options.install_pkgs:
-            configmgr.create['install_pkgs'] = []
-            for pkgtype in self.options.install_pkgs.split(','):
-                if pkgtype not in ('source', 'debuginfo', 'debugsource'):
-                    raise errors.Usage('Invalid parameter specified: "%s", '
-                                       'valid values: source, debuginfo, '
-                                       'debusource' % pkgtype)
-
-                configmgr.create['install_pkgs'].append(pkgtype)
+        cdir = 'outdir'
+        if os.path.exists(configmgr.create[cdir]) \
+           and not os.path.isdir(configmgr.create[cdir]):
+            msger.error('Invalid directory specified: %s' \
+                        % configmgr.create[cdir])
 
         if self.options.enabletmpfs:
             configmgr.create['enabletmpfs'] = self.options.enabletmpfs
 
-        if self.options.repourl:
-            for item in self.options.repourl:
-                try:
-                    key, val = item.split('=')
-                except:
-                    continue
-                configmgr.create['repourl'][key] = val
-
     def main(self, argv=None):
         if argv is None:
             argv = sys.argv
@@ -294,58 +185,3 @@ class Creator(cmdln.Cmdln):
             return ['help', argv[0]]
 
         return argv
-
-    def do_auto(self, subcmd, opts, *args):
-        """${cmd_name}: auto detect image type from magic header
-
-        Usage:
-            ${name} ${cmd_name} <ksfile>
-
-        ${cmd_option_list}
-        """
-        def parse_magic_line(re_str, pstr, ptype='mic'):
-            ptn = re.compile(re_str)
-            m = ptn.match(pstr)
-            if not m or not m.groups():
-                return None
-
-            inline_argv = m.group(1).strip()
-            if ptype == 'mic':
-                m2 = re.search('(?P<format>\w+)', inline_argv)
-            elif ptype == 'mic2':
-                m2 = re.search('(-f|--format(=)?)\s*(?P<format>\w+)',
-                               inline_argv)
-            else:
-                return None
-
-            if m2:
-                cmdname = m2.group('format')
-                inline_argv = inline_argv.replace(m2.group(0), '')
-                return (cmdname, inline_argv)
-
-            return None
-
-        if len(args) != 1:
-            raise errors.Usage("Extra arguments given")
-
-        if not os.path.exists(args[0]):
-            raise errors.CreatorError("Can't find the file: %s" % args[0])
-
-        with open(args[0], 'r') as rf:
-            first_line = rf.readline()
-
-        mic_re = '^#\s*-\*-mic-options-\*-\s+(.*)\s+-\*-mic-options-\*-'
-        mic2_re = '^#\s*-\*-mic2-options-\*-\s+(.*)\s+-\*-mic2-options-\*-'
-
-        result = parse_magic_line(mic_re, first_line, 'mic') \
-                 or parse_magic_line(mic2_re, first_line, 'mic2')
-        if not result:
-            raise errors.KsError("Invalid magic line in file: %s" % args[0])
-
-        if result[0] not in self._subcmds:
-            raise errors.KsError("Unsupport format '%s' in %s"
-                                 % (result[0], args[0]))
-
-        argv = ' '.join(result + args).split()
-        self.main(argv)
-
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 23/35] wic: Remove unused command versioning support
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (21 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 22/35] wic: Clean up Creator Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 24/35] wic: Update 'Background and Motivation' help section Tom Zanussi
                   ` (11 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

The default is F16 and there's no reason to change that, so remove
everything else.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 .../3rdparty/pykickstart/commands/bootloader.py    |  49 ------
 .../mic/3rdparty/pykickstart/commands/partition.py |  39 -----
 .../mic/3rdparty/pykickstart/handlers/control.py   | 169 ---------------------
 .../lib/mic/3rdparty/pykickstart/handlers/f10.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f11.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f12.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f13.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f14.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f15.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f7.py    |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f8.py    |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/f9.py    |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/fc3.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/fc4.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/fc5.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/fc6.py   |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/rhel3.py |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/rhel4.py |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/rhel5.py |  24 ---
 .../lib/mic/3rdparty/pykickstart/handlers/rhel6.py |  24 ---
 20 files changed, 665 deletions(-)
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f10.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f11.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f12.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f13.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f14.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f15.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f7.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f8.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f9.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc3.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc4.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc5.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc6.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel3.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel4.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel5.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel6.py

diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py b/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py
index b227fac..c2b552f 100644
--- a/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py
+++ b/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py
@@ -214,52 +214,3 @@ class F15_Bootloader(F14_Bootloader):
         op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False)
         op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string")
         return op
-
-class RHEL5_Bootloader(FC4_Bootloader):
-    removedKeywords = FC4_Bootloader.removedKeywords
-    removedAttrs = FC4_Bootloader.removedAttrs
-
-    def __init__(self, writePriority=10, *args, **kwargs):
-        FC4_Bootloader.__init__(self, writePriority, *args, **kwargs)
-
-        self.hvArgs = kwargs.get("hvArgs", "")
-
-    def _getArgsAsStr(self):
-        ret = FC4_Bootloader._getArgsAsStr(self)
-
-        if self.hvArgs:
-            ret += " --hvargs=\"%s\"" %(self.hvArgs,)
-
-        return ret
-
-    def _getParser(self):
-        op = FC4_Bootloader._getParser(self)
-        op.add_option("--hvargs", dest="hvArgs", type="string")
-        return op
-
-class RHEL6_Bootloader(F12_Bootloader):
-    removedKeywords = F12_Bootloader.removedKeywords
-    removedAttrs = F12_Bootloader.removedAttrs
-
-    def __init__(self, writePriority=10, *args, **kwargs):
-        F12_Bootloader.__init__(self, writePriority, *args, **kwargs)
-
-        self.isCrypted = kwargs.get("isCrypted", False)
-
-    def _getArgsAsStr(self):
-        ret = F12_Bootloader._getArgsAsStr(self)
-
-        if self.isCrypted:
-            ret += " --iscrypted"
-
-        return ret
-
-    def _getParser(self):
-        def password_cb(option, opt_str, value, parser):
-            parser.values.isCrypted = True
-            parser.values.password = value
-
-        op = F12_Bootloader._getParser(self)
-        op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False)
-        op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string")
-        return op
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py b/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py
index e65e012..56b91aa 100644
--- a/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py
+++ b/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py
@@ -115,26 +115,6 @@ class FC4_PartData(FC3_PartData):
 
         return retval
 
-class RHEL5_PartData(FC4_PartData):
-    removedKeywords = FC4_PartData.removedKeywords
-    removedAttrs = FC4_PartData.removedAttrs
-
-    def __init__(self, *args, **kwargs):
-        FC4_PartData.__init__(self, *args, **kwargs)
-        self.encrypted = kwargs.get("encrypted", False)
-        self.passphrase = kwargs.get("passphrase", "")
-
-    def _getArgsAsStr(self):
-        retval = FC4_PartData._getArgsAsStr(self)
-
-        if self.encrypted:
-            retval += " --encrypted"
-
-            if self.passphrase != "":
-                retval += " --passphrase=\"%s\"" % self.passphrase
-
-        return retval
-
 class F9_PartData(FC4_PartData):
     removedKeywords = FC4_PartData.removedKeywords + ["bytesPerInode"]
     removedAttrs = FC4_PartData.removedAttrs + ["bytesPerInode"]
@@ -281,25 +261,6 @@ class FC4_Partition(FC3_Partition):
         op.add_option("--label", dest="label")
         return op
 
-class RHEL5_Partition(FC4_Partition):
-    removedKeywords = FC4_Partition.removedKeywords
-    removedAttrs = FC4_Partition.removedAttrs
-
-    def __init__(self, writePriority=130, *args, **kwargs):
-        FC4_Partition.__init__(self, writePriority, *args, **kwargs)
-
-        def part_cb (option, opt_str, value, parser):
-            if value.startswith("/dev/"):
-                parser.values.ensure_value(option.dest, value[5:])
-            else:
-                parser.values.ensure_value(option.dest, value)
-
-    def _getParser(self):
-        op = FC4_Partition._getParser(self)
-        op.add_option("--encrypted", action="store_true", default=False)
-        op.add_option("--passphrase")
-        return op
-
 class F9_Partition(FC4_Partition):
     removedKeywords = FC4_Partition.removedKeywords
     removedAttrs = FC4_Partition.removedAttrs
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/control.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/control.py
index f6828a4..8dc80d1 100644
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/control.py
+++ b/scripts/lib/mic/3rdparty/pykickstart/handlers/control.py
@@ -26,130 +26,12 @@ from pykickstart.commands import *
 # command names can map to the same class.  However, the Handler will ensure
 # that only one instance of each class ever exists.
 commandMap = {
-    FC3: {
-        "bootloader": bootloader.FC3_Bootloader,
-        "part": partition.FC3_Partition,
-        "partition": partition.FC3_Partition,
-    },
-
-    # based on fc3
-    FC4: {
-        "bootloader": bootloader.FC4_Bootloader,
-        "part": partition.FC4_Partition,
-        "partition": partition.FC4_Partition,
-    },
-
-    # based on fc4
-    FC5: {
-        "bootloader": bootloader.FC4_Bootloader,
-        "part": partition.FC4_Partition,
-        "partition": partition.FC4_Partition,
-    },
-
-    # based on fc5
-    FC6: {
-        "bootloader": bootloader.FC4_Bootloader,
-        "part": partition.FC4_Partition,
-        "partition": partition.FC4_Partition,
-    },
-
-    # based on fc6
-    F7: {
-        "bootloader": bootloader.FC4_Bootloader,
-        "part": partition.FC4_Partition,
-        "partition": partition.FC4_Partition,
-    },
-
-    # based on f7
-    F8: {
-        "bootloader": bootloader.F8_Bootloader,
-        "part": partition.FC4_Partition,
-        "partition": partition.FC4_Partition,
-    },
-
-    # based on f8
-    F9: {
-        "bootloader": bootloader.F8_Bootloader,
-        "part": partition.F9_Partition,
-        "partition": partition.F9_Partition,
-    },
-
-    # based on f9
-    F10: {
-        "bootloader": bootloader.F8_Bootloader,
-        "part": partition.F9_Partition,
-        "partition": partition.F9_Partition,
-    },
-
-    # based on f10
-    F11: {
-        "bootloader": bootloader.F8_Bootloader,
-        "part": partition.F11_Partition,
-        "partition": partition.F11_Partition,
-    },
-
-    # based on f11
-    F12: {
-        "bootloader": bootloader.F12_Bootloader,
-        "part": partition.F12_Partition,
-        "partition": partition.F12_Partition,
-    },
-
-    # based on f12
-    F13: {
-        "bootloader": bootloader.F12_Bootloader,
-        "part": partition.F12_Partition,
-        "partition": partition.F12_Partition,
-    },
-
-    # based on f13
-    F14: {
-        "bootloader": bootloader.F14_Bootloader,
-        "part": partition.F14_Partition,
-        "partition": partition.F14_Partition,
-    },
-
-    # based on f14
-    F15: {
-        "bootloader": bootloader.F15_Bootloader,
-        "part": partition.F14_Partition,
-        "partition": partition.F14_Partition,
-    },
-
     # based on f15
     F16: {
         "bootloader": bootloader.F15_Bootloader,
         "part": partition.F14_Partition,
         "partition": partition.F14_Partition,
     },
-
-    # based on fc1
-    RHEL3: {
-        "bootloader": bootloader.FC3_Bootloader,
-        "part": partition.FC3_Partition,
-        "partition": partition.FC3_Partition,
-    },
-
-    # based on fc3
-    RHEL4: {
-        "bootloader": bootloader.FC3_Bootloader,
-        "part": partition.FC3_Partition,
-        "partition": partition.FC3_Partition,
-    },
-
-    # based on fc6
-    RHEL5: {
-        "bootloader": bootloader.RHEL5_Bootloader,
-        "part": partition.RHEL5_Partition,
-        "partition": partition.RHEL5_Partition,
-    },
-
-    # based on f13ish
-    RHEL6: {
-        "bootloader": bootloader.RHEL6_Bootloader,
-        "part": partition.F12_Partition,
-        "partition": partition.F12_Partition,
-    }
 }
 
 # This map is keyed on kickstart syntax version as provided by
@@ -158,58 +40,7 @@ commandMap = {
 # each name maps to exactly one data class and all data classes have a name.
 # More than one instance of each class is allowed to exist, however.
 dataMap = {
-    FC3: {
-        "PartData": partition.FC3_PartData,
-    },
-    FC4: {
-        "PartData": partition.FC4_PartData,
-    },
-    FC5: {
-        "PartData": partition.FC4_PartData,
-    },
-    FC6: {
-        "PartData": partition.FC4_PartData,
-    },
-    F7: {
-        "PartData": partition.FC4_PartData,
-    },
-    F8: {
-        "PartData": partition.FC4_PartData,
-    },
-    F9: {
-        "PartData": partition.F9_PartData,
-    },
-    F10: {
-        "PartData": partition.F9_PartData,
-    },
-    F11: {
-        "PartData": partition.F11_PartData,
-    },
-    F12: {
-        "PartData": partition.F12_PartData,
-    },
-    F13: {
-        "PartData": partition.F12_PartData,
-    },
-    F14: {
-        "PartData": partition.F14_PartData,
-    },
-    F15: {
-        "PartData": partition.F14_PartData,
-    },
     F16: {
         "PartData": partition.F14_PartData,
     },
-    RHEL3: {
-        "PartData": partition.FC3_PartData,
-    },
-    RHEL4: {
-        "PartData": partition.FC3_PartData,
-    },
-    RHEL5: {
-        "PartData": partition.RHEL5_PartData,
-    },
-    RHEL6: {
-        "PartData": partition.F12_PartData,
-    }
 }
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f10.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f10.py
deleted file mode 100644
index 17c8211..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f10.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2008 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F10Handler(BaseHandler):
-    version = F10
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f11.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f11.py
deleted file mode 100644
index d21aee3..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f11.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2008 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F11Handler(BaseHandler):
-    version = F11
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f12.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f12.py
deleted file mode 100644
index cea3ece..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f12.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2009 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F12Handler(BaseHandler):
-    version = F12
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f13.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f13.py
deleted file mode 100644
index b94c738..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f13.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2009 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F13Handler(BaseHandler):
-    version = F13
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f14.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f14.py
deleted file mode 100644
index 478f75d..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f14.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2010 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F14Handler(BaseHandler):
-    version = F14
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f15.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f15.py
deleted file mode 100644
index 12aecb4..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f15.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2010 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F15Handler(BaseHandler):
-    version = F15
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f7.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f7.py
deleted file mode 100644
index 5e856ea..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f7.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F7Handler(BaseHandler):
-    version = F7
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f8.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f8.py
deleted file mode 100644
index 1a97881..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f8.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F8Handler(BaseHandler):
-    version = F8
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f9.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/f9.py
deleted file mode 100644
index 116f1b5..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/f9.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class F9Handler(BaseHandler):
-    version = F9
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc3.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/fc3.py
deleted file mode 100644
index a115dc2..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc3.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2005, 2006, 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class FC3Handler(BaseHandler):
-    version = FC3
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc4.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/fc4.py
deleted file mode 100644
index fd47b73..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc4.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class FC4Handler(BaseHandler):
-    version = FC4
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc5.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/fc5.py
deleted file mode 100644
index bcdc29d..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc5.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class FC5Handler(BaseHandler):
-    version = FC5
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc6.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/fc6.py
deleted file mode 100644
index c83a929..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/fc6.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2006, 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class FC6Handler(BaseHandler):
-    version = FC6
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel3.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel3.py
deleted file mode 100644
index 131763c..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel3.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class RHEL3Handler(BaseHandler):
-    version = RHEL3
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel4.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel4.py
deleted file mode 100644
index 3496c43..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel4.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class RHEL4Handler(BaseHandler):
-    version = RHEL4
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel5.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel5.py
deleted file mode 100644
index abb7a8d..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel5.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2007 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class RHEL5Handler(BaseHandler):
-    version = RHEL5
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel6.py b/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel6.py
deleted file mode 100644
index 7202419..0000000
--- a/scripts/lib/mic/3rdparty/pykickstart/handlers/rhel6.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Chris Lumens <clumens@redhat.com>
-#
-# Copyright 2010 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-from pykickstart.base import *
-from pykickstart.version import *
-
-class RHEL6Handler(BaseHandler):
-    version = RHEL6
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 24/35] wic: Update 'Background and Motivation' help section
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (22 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 23/35] wic: Remove unused command versioning support Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 25/35] wic: Remove unused conf support Tom Zanussi
                   ` (10 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

Remove help text regarding the source and future intentions of the wic
codebase, since the code prompting those comments has now been mostly
removed.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/image/help.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py
index 6e8e037..6503aaa 100644
--- a/scripts/lib/image/help.py
+++ b/scripts/lib/image/help.py
@@ -456,24 +456,12 @@ DESCRIPTION
     oe-core: directdisk.bbclass and mkefidisk.sh.  The difference
     between wic and those examples is that with wic the functionality
     of those scripts is implemented by a general-purpose partitioning
-    'language' based on Redhat kickstart syntax (with the underlying
-    code borrowed from Tizen mic, which in turn was borrowed from
-    Meego mic, in turn borrowed from Fedora livecd, etc.).
+    'language' based on Redhat kickstart syntax).
 
     The initial motivation and design considerations that lead to the
     current tool are described exhaustively in Yocto Bug #3847
     (https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847).
 
-    Though the current wic tool only uses the kickstart syntax related
-    to partitioning and bootloaders and only for creating images,
-    because the code is based on the mic/pykickstart code, future
-    deployment efforts such as those partially described by Yocto Bug
-    #4106 (https://bugzilla.yoctoproject.org/show_bug.cgi?id=4106),
-    but also others including package selection (from e.g. binary
-    feeds) and deployment configuration of users/network/services,
-    etc, could be implemented under this framework, considering that
-    all of those are implemented in some form by the base system.
-
   Implementation and Examples
 
     wic can be used in two different modes, depending on how much
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 25/35] wic: Remove unused conf support
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (23 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 24/35] wic: Update 'Background and Motivation' help section Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 26/35] wic: Remove Mount object Tom Zanussi
                   ` (9 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

Also fix up users such as imager functions.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/image/config/wic.conf               |  1 -
 scripts/lib/mic/conf.py                         | 39 --------------------
 scripts/lib/mic/imager/baseimager.py            | 13 ++-----
 scripts/lib/mic/imager/direct.py                |  6 ++--
 scripts/lib/mic/plugins/imager/direct_plugin.py |  4 +--
 scripts/lib/mic/utils/misc.py                   | 48 +------------------------
 6 files changed, 8 insertions(+), 103 deletions(-)

diff --git a/scripts/lib/image/config/wic.conf b/scripts/lib/image/config/wic.conf
index e96d6ae..a51bcb5 100644
--- a/scripts/lib/image/config/wic.conf
+++ b/scripts/lib/image/config/wic.conf
@@ -4,4 +4,3 @@ distro_name = OpenEmbedded
 
 [create]
 ; settings for create subcommand
-runtime=native
diff --git a/scripts/lib/mic/conf.py b/scripts/lib/mic/conf.py
index 1fe6edd..a686e9c 100644
--- a/scripts/lib/mic/conf.py
+++ b/scripts/lib/mic/conf.py
@@ -31,45 +31,18 @@ def get_siteconf():
     return scripts_path + "/lib/image/config/wic.conf"
 
 class ConfigMgr(object):
-    prefer_backends = ["zypp", "yum"]
-
     DEFAULTS = {'common': {
                     "distro_name": "Default Distribution",
                     "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also?
                 },
                 'create': {
                     "tmpdir": '/var/tmp/wic',
-                    "cachedir": '/var/tmp/wic/cache',
                     "outdir": './wic-output',
 
-                    "arch": None, # None means auto-detect
-                    "pkgmgr": "auto",
-                    "name": "output",
-                    "ksfile": None,
-                    "ks": None,
-                    "repomd": None,
-                    "local_pkgs_path": None,
                     "release": None,
                     "logfile": None,
-                    "record_pkgs": [],
-                    "pack_to": None,
                     "name_prefix": None,
                     "name_suffix": None,
-                    "copy_kernel": False,
-                    "install_pkgs": None,
-                    "repourl": {},
-                    "localrepos": [],  # save localrepos
-                    "runtime": "bootstrap",
-                },
-                'chroot': {
-                    "saveto": None,
-                },
-                'convert': {
-                    "shell": False,
-                },
-                'bootstrap': {
-                    "rootdir": '/var/tmp/wic-bootstrap',
-                    "packages": [],
                 },
                }
 
@@ -116,10 +89,6 @@ class ConfigMgr(object):
         if not ksconf:
             return
 
-        ksconf = misc.normalize_ksfile(ksconf,
-                                       self.create['release'],
-                                       self.create['arch'])
-
         ks = kickstart.read_kickstart(ksconf)
 
         self.create['ks'] = ks
@@ -130,12 +99,4 @@ class ConfigMgr(object):
                                               self.create['name_prefix'],
                                               self.create['name_suffix'])
 
-    def set_runtime(self, runtime):
-        if runtime not in ("bootstrap", "native"):
-            msger.error("Invalid runtime mode: %s" % runtime)
-
-        if misc.get_distro()[0] in ("tizen", "Tizen"):
-            runtime = "native"
-        self.create['runtime'] = runtime
-
 configmgr = ConfigMgr()
diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/mic/imager/baseimager.py
index 55f2dea..0d591ea 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/mic/imager/baseimager.py
@@ -176,7 +176,7 @@ class BaseImageCreator(object):
 
         runner.show('umount -l %s' % self.workdir)
 
-    def mount(self, base_on = None, cachedir = None):
+    def mount(self):
         """Setup the target filesystem in preparation for an install.
 
         This function sets up the filesystem which the ImageCreator will
@@ -184,20 +184,11 @@ class BaseImageCreator(object):
         install root directory, bind mounts some system directories (e.g. /dev)
         and writes out /etc/fstab. Other subclasses may also e.g. create a
         sparse file, format it and loopback mount it to the install root.
-
-        base_on -- a previous install on which to base this install; defaults
-                   to None, causing a new image to be created
-
-        cachedir -- a directory in which to store the Yum cache; defaults to
-                    None, causing a new cache to be created; by setting this
-                    to another directory, the same cache can be reused across
-                    multiple installs.
-
         """
         self.__setup_tmpdir()
         self.__ensure_builddir()
 
-        self._mount_instroot(base_on)
+        self._mount_instroot()
 
     def unmount(self):
         """Unmounts the target filesystem.
diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 92473b5..2e6914b 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -217,7 +217,7 @@ class DirectImageCreator(BaseImageCreator):
     #
     # Actual implemention
     #
-    def _mount_instroot(self, base_on = None):
+    def _mount_instroot(self):
         """
         For 'wic', we already have our build artifacts and don't want
         to loop mount anything to install into, we just create
@@ -296,7 +296,7 @@ class DirectImageCreator(BaseImageCreator):
 
         self.__instimage.mount()
 
-    def install(self, repo_urls=None):
+    def install(self):
         """
         Install fs images into partitions
         """
@@ -306,7 +306,7 @@ class DirectImageCreator(BaseImageCreator):
                         % (disk_name, full_path, disk['min_size']))
             self.__instimage.install(full_path)
 
-    def configure(self, repodata = None):
+    def configure(self):
         """
         Configure the system image according to kickstart.
 
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py
index 877aaf6..793a736 100644
--- a/scripts/lib/mic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/mic/plugins/imager/direct_plugin.py
@@ -91,9 +91,9 @@ class DirectPlugin(ImagerPlugin):
                                             creatoropts)
 
         try:
-            creator.mount(None, creatoropts["cachedir"])
+            creator.mount()
             creator.install()
-            creator.configure(creatoropts["repomd"])
+            creator.configure()
             creator.print_outimage_info()
 
         except errors.CreatorError:
diff --git a/scripts/lib/mic/utils/misc.py b/scripts/lib/mic/utils/misc.py
index 010b16c..194b88f 100644
--- a/scripts/lib/mic/utils/misc.py
+++ b/scripts/lib/mic/utils/misc.py
@@ -19,11 +19,6 @@ import os
 import sys
 import time
 
-from mic import msger
-from mic.utils.errors import CreatorError
-from mic.utils.fs_related import find_binary_path, makedirs
-from mic.utils import runner
-
 def build_name(kscfg, release=None, prefix = None, suffix = None):
     """Construct and return an image name string.
 
@@ -60,46 +55,5 @@ def build_name(kscfg, release=None, prefix = None, suffix = None):
     suffix = "-%s" % suffix if suffix else ""
 
     ret = prefix + name + suffix
-    return ret
-
-def normalize_ksfile(ksconf, release, arch):
-    '''
-    Return the name of a normalized ks file in which macro variables
-    @BUILD_ID@ and @ARCH@ are replace with real values.
-
-    The original ks file is returned if no special macro is used, otherwise
-    a temp file is created and returned, which will be deleted when program
-    exits normally.
-    '''
-
-    if not release:
-        release = "latest"
-    if not arch or re.match(r'i.86', arch):
-        arch = "ia32"
-
-    with open(ksconf) as f:
-        ksc = f.read()
-
-    if "@ARCH@" not in ksc and "@BUILD_ID@" not in ksc:
-        return ksconf
 
-    msger.info("Substitute macro variable @BUILD_ID@/@ARCH@ in ks: %s" % ksconf)
-    ksc = ksc.replace("@ARCH@", arch)
-    ksc = ksc.replace("@BUILD_ID@", release)
-
-    fd, ksconf = tempfile.mkstemp(prefix=os.path.basename(ksconf))
-    os.write(fd, ksc)
-    os.close(fd)
-
-    msger.debug('normalized ks file:%s' % ksconf)
-
-    def remove_temp_ks():
-        try:
-            os.unlink(ksconf)
-        except OSError, err:
-            msger.warning('Failed to remove temp ks file:%s:%s' % (ksconf, err))
-
-    import atexit
-    atexit.register(remove_temp_ks)
-
-    return ksconf
+    return ret
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 26/35] wic: Remove Mount object
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (24 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 25/35] wic: Remove unused conf support Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 27/35] wic: Update/rename/delete mount-related code Tom Zanussi
                   ` (8 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

It doesn't do anything we need, so remove it and fix up callers/base
classes.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/fs_related.py    | 16 ----------------
 scripts/lib/mic/utils/partitionedfs.py |  4 +---
 2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/mic/utils/fs_related.py
index e6e362d..07a5ff9 100644
--- a/scripts/lib/mic/utils/fs_related.py
+++ b/scripts/lib/mic/utils/fs_related.py
@@ -112,19 +112,3 @@ class DiskImage(Disk):
         exec_cmd(dd_cmd)
 
         self.device = self.image_file
-
-
-class Mount:
-    """A generic base class to deal with mounting things."""
-    def __init__(self, mountdir):
-        self.mountdir = mountdir
-
-    def cleanup(self):
-        self.unmount()
-
-    def mount(self, options = None):
-        pass
-
-    def unmount(self):
-        pass
-
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index ef92125..50536b4 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -32,9 +32,8 @@ MBR_OVERHEAD = 1
 # Size of a sector in bytes
 SECTOR_SIZE = 512
 
-class PartitionedMount(Mount):
+class PartitionedMount:
     def __init__(self, mountdir):
-        Mount.__init__(self, mountdir)
         self.disks = {}
         self.partitions = []
         self.mountOrder = []
@@ -316,7 +315,6 @@ class PartitionedMount(Mount):
         self.unmountOrder.reverse()
 
     def cleanup(self):
-        Mount.cleanup(self)
         if self.disks:
             for dev in self.disks.keys():
                 d = self.disks[dev]
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 27/35] wic: Update/rename/delete mount-related code
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (25 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 26/35] wic: Remove Mount object Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 28/35] wic: Update cleanup/unmount-related code Tom Zanussi
                   ` (7 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

The wic code inherited a basic image-creation flow based on mounting
loop devices, but wic doesn't actually mount anything, so rename parts
of the code dealing with mounting to something more appropriate, and
remove related unused code.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/baseimager.py            | 47 +++++--------------------
 scripts/lib/mic/imager/direct.py                | 42 ++++++----------------
 scripts/lib/mic/plugins/imager/direct_plugin.py |  2 +-
 scripts/lib/mic/utils/partitionedfs.py          | 37 ++-----------------
 4 files changed, 22 insertions(+), 106 deletions(-)

diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/mic/imager/baseimager.py
index 0d591ea..7f32dd5 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/mic/imager/baseimager.py
@@ -97,41 +97,15 @@ class BaseImageCreator(object):
 
 
     #
-    # Properties
-    #
-    def __get_instroot(self):
-        if self.__builddir is None:
-            raise CreatorError("_instroot is not valid before calling mount()")
-        return self.__builddir + "/install_root"
-    _instroot = property(__get_instroot)
-    """The location of the install root directory.
-
-    This is the directory into which the system is installed. Subclasses may
-    mount a filesystem image here or copy files to/from here.
-
-    Note, this directory does not exist before ImageCreator.mount() is called.
-
-    Note also, this is a read-only attribute.
-
-    """
-
-
-    #
     # Hooks for subclasses
     #
-    def _mount_instroot(self, base_on = None):
-        """Mount or prepare the install root directory.
+    def _create(self):
+        """Create partitions for the disk image(s)
 
-        This is the hook where subclasses may prepare the install root by e.g.
-        mounting creating and loopback mounting a filesystem image to
-        _instroot.
+        This is the hook where subclasses may create the partitions
+        that will be assembled into disk image(s).
 
         There is no default implementation.
-
-        base_on -- this is the value passed to mount() and can be interpreted
-                   as the subclass wishes; it might e.g. be the location of
-                   a previously created ISO containing a system image.
-
         """
         pass
 
@@ -176,19 +150,16 @@ class BaseImageCreator(object):
 
         runner.show('umount -l %s' % self.workdir)
 
-    def mount(self):
-        """Setup the target filesystem in preparation for an install.
+    def create(self):
+        """Create partitions for the disk image(s)
 
-        This function sets up the filesystem which the ImageCreator will
-        install into and configure. The ImageCreator class merely creates an
-        install root directory, bind mounts some system directories (e.g. /dev)
-        and writes out /etc/fstab. Other subclasses may also e.g. create a
-        sparse file, format it and loopback mount it to the install root.
+        Create the partitions that will be assembled into disk
+        image(s).
         """
         self.__setup_tmpdir()
         self.__ensure_builddir()
 
-        self._mount_instroot()
+        self._create()
 
     def unmount(self):
         """Unmounts the target filesystem.
diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 2e6914b..b96740d 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -79,9 +79,10 @@ class DirectImageCreator(BaseImageCreator):
         self.staging_data_dir = staging_data_dir
 
     def __write_fstab(self, image_rootfs):
-        """overriden to generate fstab (temporarily) in rootfs. This
-        is called from mount_instroot, make sure it doesn't get called
-        from BaseImage.mount()"""
+        """overriden to generate fstab (temporarily) in rootfs. This is called
+        from _create, make sure it doesn't get called from
+        BaseImage.create()
+        """
         if image_rootfs is None:
             return None
 
@@ -217,29 +218,15 @@ class DirectImageCreator(BaseImageCreator):
     #
     # Actual implemention
     #
-    def _mount_instroot(self):
+    def _create(self):
         """
-        For 'wic', we already have our build artifacts and don't want
-        to loop mount anything to install into, we just create
+        For 'wic', we already have our build artifacts - we just create
         filesystems from the artifacts directly and combine them into
         a partitioned image.
-
-        We still want to reuse as much of the basic mic machinery
-        though; despite the fact that we don't actually do loop or any
-        other kind of mounting we still want to do many of the same
-        things to prepare images, so we basically just adapt to the
-        basic framework and reinterpret what 'mounting' means in our
-        context.
-
-        _instroot would normally be something like
-        /var/tmp/wic/build/imgcreate-s_9AKQ/install_root, for
-        installing packages, etc.  We don't currently need to do that,
-        so we simplify life by just using /var/tmp/wic/build as our
-        workdir.
         """
         parts = self._get_parts()
 
-        self.__instimage = PartitionedMount(self._instroot)
+        self.__instimage = PartitionedMount()
 
         for p in parts:
             # as a convenience, set source to the boot partition source
@@ -250,20 +237,11 @@ class DirectImageCreator(BaseImageCreator):
         for p in parts:
             # need to create the filesystems in order to get their
             # sizes before we can add them and do the layout.
-            # PartitionedMount.mount() actually calls __format_disks()
+            # PartitionedMount.create() actually calls __format_disks()
             # to create the disk images and carve out the partitions,
             # then self.install() calls PartitionedMount.install()
             # which calls __install_partitition() for each partition
-            # to dd the fs into the partitions.  It would be nice to
-            # be able to use e.g. ExtDiskMount etc to create the
-            # filesystems, since that's where existing e.g. mkfs code
-            # is, but those are only created after __format_disks()
-            # which needs the partition sizes so needs them created
-            # before its called.  Well, the existing setup is geared
-            # to installing packages into mounted filesystems - maybe
-            # when/if we need to actually do package selection we
-            # should modify things to use those objects, but for now
-            # we can avoid that.
+            # to dd the fs into the partitions.
 
             fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
 
@@ -294,7 +272,7 @@ class DirectImageCreator(BaseImageCreator):
             self.__disks[disk_name] = disk_obj
             self.__instimage.add_disk(disk_name, disk_obj)
 
-        self.__instimage.mount()
+        self.__instimage.create()
 
     def install(self):
         """
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py
index 793a736..da18b65 100644
--- a/scripts/lib/mic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/mic/plugins/imager/direct_plugin.py
@@ -91,7 +91,7 @@ class DirectPlugin(ImagerPlugin):
                                             creatoropts)
 
         try:
-            creator.mount()
+            creator.create()
             creator.install()
             creator.configure()
             creator.print_outimage_info()
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index 50536b4..43a38a9 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -33,11 +33,9 @@ MBR_OVERHEAD = 1
 SECTOR_SIZE = 512
 
 class PartitionedMount:
-    def __init__(self, mountdir):
+    def __init__(self):
         self.disks = {}
         self.partitions = []
-        self.mountOrder = []
-        self.unmountOrder = []
         self.parted = find_binary_path("parted")
         # Size of a sector used in calculations
         self.sector_size = SECTOR_SIZE
@@ -102,7 +100,6 @@ class PartitionedMount:
                      'label': label, # Partition label
                      'disk_name': disk_name, # physical disk name holding partition
                      'device': None, # kpartx device node for partition
-                     'mount': None, # Mount object
                      'num': None, # Partition number
                      'boot': boot, # Bootable flag
                      'align': align, # Partition alignment
@@ -303,17 +300,6 @@ class PartitionedMount:
                     self.__run_parted(["-s", d['disk'].device, "set",
                                        "%d" % p['num'], "lba", "off"])
 
-    def __calculate_mountorder(self):
-        msger.debug("Calculating mount order")
-        for p in self.partitions:
-            if p['mountpoint']:
-                self.mountOrder.append(p['mountpoint'])
-                self.unmountOrder.append(p['mountpoint'])
-
-        self.mountOrder.sort()
-        self.unmountOrder.sort()
-        self.unmountOrder.reverse()
-
     def cleanup(self):
         if self.disks:
             for dev in self.disks.keys():
@@ -323,23 +309,6 @@ class PartitionedMount:
                 except:
                     pass
 
-    def unmount(self):
-        for mp in self.unmountOrder:
-            if mp == 'swap':
-                continue
-            p = None
-            for p1 in self.partitions:
-                if p1['mountpoint'] == mp:
-                    p = p1
-                    break
-
-            if p['mount'] != None:
-                try:
-                    p['mount'].cleanup()
-                except:
-                    pass
-                p['mount'] = None
-
     def __install_partition(self, num, source_file, start, size):
         """
         Install source_file contents into a partition.
@@ -375,13 +344,11 @@ class PartitionedMount:
             self.__install_partition(p['num'], p['source_file'],
                                      p['start'], p['size'])
 
-    def mount(self):
+    def create(self):
         for dev in self.disks.keys():
             d = self.disks[dev]
             d['disk'].create()
 
         self.__format_disks()
 
-        self.__calculate_mountorder()
-
         return
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 28/35] wic: Update cleanup/unmount-related code
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (26 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 27/35] wic: Update/rename/delete mount-related code Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 29/35] wic: Update/rename install-related code Tom Zanussi
                   ` (6 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

The wic code inherited a basic image-creation flow based on mounting
loop devices, but wic doesn't actually mount or unmount anything, so
get rid of unmount() and consolidate whatever it did do with
cleanup().

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/baseimager.py | 28 ++++++----------------------
 scripts/lib/mic/imager/direct.py     |  2 +-
 2 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/mic/imager/baseimager.py
index 7f32dd5..23919d4 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/mic/imager/baseimager.py
@@ -109,12 +109,11 @@ class BaseImageCreator(object):
         """
         pass
 
-    def _unmount_instroot(self):
-        """Undo anything performed in _mount_instroot().
+    def _cleanup(self):
+        """Undo anything performed in _create().
 
-        This is the hook where subclasses must undo anything which was done
-        in _mount_instroot(). For example, if a filesystem image was mounted
-        onto _instroot, it should be unmounted here.
+        This is the hook where subclasses must undo anything which was
+        done in _create().
 
         There is no default implementation.
 
@@ -161,23 +160,8 @@ class BaseImageCreator(object):
 
         self._create()
 
-    def unmount(self):
-        """Unmounts the target filesystem.
-
-        The ImageCreator class detaches the system from the install root, but
-        other subclasses may also detach the loopback mounted filesystem image
-        from the install root.
-
-        """
-        self._unmount_instroot()
-
-
     def cleanup(self):
-        """Unmounts the target filesystem and deletes temporary files.
-
-        This method calls unmount() and then deletes any temporary files and
-        directories that were created on the host system while building the
-        image.
+        """Undo anything performed in create().
 
         Note, make sure to call this method once finished with the creator
         instance in order to ensure no stale files are left on the host e.g.:
@@ -192,7 +176,7 @@ class BaseImageCreator(object):
         if not self.__builddir:
             return
 
-        self.unmount()
+        self._cleanup()
 
         shutil.rmtree(self.__builddir, ignore_errors = True)
         self.__builddir = None
diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index b96740d..91f64d5 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -354,7 +354,7 @@ class DirectImageCreator(BaseImageCreator):
 
         return (rootdev, root_part_uuid)
 
-    def _unmount_instroot(self):
+    def _cleanup(self):
         if not self.__instimage is None:
             try:
                 self.__instimage.cleanup()
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 00/35] wic: diet and refactor
@ 2014-08-08 22:05 Tom Zanussi
  2014-08-08 22:05 ` [PATCH 01/35] wic: Make exec_cmd() error out instead of warn Tom Zanussi
                   ` (34 more replies)
  0 siblings, 35 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

This patchset refactors wic to have the code better reflect what it
actually does, rather than look like something shoehorned into the
existing mic codebase, which is essentially what it was.

It also removes most of code inherited from mic but sitting
essentially unused; there's no reason to be carrying it around other
than some vague intention of reusing it, but that can still be done -
anything needed can always be added back.  As it stands, it's only
taking up space and obscuring a clear view of what's actually used.

Removing the bsp subdir from scripts/lib, and taking a size
measurement using 'du -bh lib', we get:

before:
  1.2M  lib

after:
  385K  lib

About half the code remaining after this exercise belongs to the
parser and related infrastructure, which could be drop-in replaced by
something lighter:

116K	    lib/wic/3rdparty
7.9K	    lib/wic/msger.py
3.2K	    lib/wic/conf.py
3.1K	    lib/wic/utils/runner.py
57K	    lib/wic/utils/cmdln.py
1.6K	    lib/wic/utils/errors.py

And about 50k of it is wic command boilerplate and help text patterned
after other tools in yocto such as yocto-bsp:

52K	    lib/image

That leaves about 150k related to the actual image creation
infrastructure, which should be much more easily digestible than the
previous code.

[NOTE: this patchset supersedes the 'phase1' patchset ('[PATCH 00/24]
wic: Remove unused code') from Aug 5.]

The following changes since commit 4a226369b7bb37a971c77d4abc88df81033f56c5:

  dev-manual: Updates for checksums and wic (2014-08-02 10:00:26 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib.git tzanussi/wic-diet-v1
  http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=tzanussi/wic-diet-v1

Tom Zanussi (35):
  wic: Make exec_cmd() error out instead of warn
  wic: Remove unused custom commands
  wic: Remove packaging, config commands
  wic: Remove mic bootstrap
  wic: Remove mic chroot
  wic: Remove rt_util
  wic: Remove mic package managers
  wic: Remove bmap support
  wic: Remove fiemap support
  wic: Remove grabber implementation
  wic: Remove proxy support
  wic: Remove rpmmisc
  wic: Remove unused fs_related code
  wic: Remove unused misc code
  wic: Remove 3rdparty/urlgrabber
  wic: Remove unused 3rdparty/commands
  wic: Remove gpt_parser
  wic: Remove unused plugin and error code
  wic: Clean up BaseImageCreator
  wic: Clean up DirectImageCreator
  wic: Clean up PartitionedMount
  wic: Clean up Creator
  wic: Remove unused command versioning support
  wic: Update 'Background and Motivation' help section
  wic: Remove unused conf support
  wic: Remove Mount object
  wic: Update/rename/delete mount-related code
  wic: Update cleanup/unmount-related code
  wic: Update/rename install-related code
  wic: Update/rename configure-related code
  wic: Rename PartitionedMount
  wic: Rename MountError
  wic: Update Disk description
  wic: Rename /mic to /wic
  wic: Bump the version to 2.0

 scripts/lib/image/config/wic.conf                  |    1 -
 scripts/lib/image/engine.py                        |   12 +-
 scripts/lib/image/help.py                          |   22 +-
 .../mic/3rdparty/pykickstart/commands/__init__.py  |   26 -
 .../3rdparty/pykickstart/commands/authconfig.py    |   40 -
 .../mic/3rdparty/pykickstart/commands/autopart.py  |  119 --
 .../mic/3rdparty/pykickstart/commands/autostep.py  |   55 -
 .../mic/3rdparty/pykickstart/commands/clearpart.py |   86 --
 .../mic/3rdparty/pykickstart/commands/device.py    |  125 --
 .../3rdparty/pykickstart/commands/deviceprobe.py   |   40 -
 .../3rdparty/pykickstart/commands/displaymode.py   |   68 -
 .../mic/3rdparty/pykickstart/commands/dmraid.py    |   91 --
 .../3rdparty/pykickstart/commands/driverdisk.py    |  184 ---
 .../lib/mic/3rdparty/pykickstart/commands/fcoe.py  |  114 --
 .../mic/3rdparty/pykickstart/commands/firewall.py  |  193 ---
 .../mic/3rdparty/pykickstart/commands/firstboot.py |   62 -
 .../lib/mic/3rdparty/pykickstart/commands/group.py |   88 --
 .../3rdparty/pykickstart/commands/ignoredisk.py    |  139 --
 .../3rdparty/pykickstart/commands/interactive.py   |   58 -
 .../lib/mic/3rdparty/pykickstart/commands/iscsi.py |  133 --
 .../mic/3rdparty/pykickstart/commands/iscsiname.py |   54 -
 .../lib/mic/3rdparty/pykickstart/commands/key.py   |   64 -
 .../mic/3rdparty/pykickstart/commands/keyboard.py  |   55 -
 .../lib/mic/3rdparty/pykickstart/commands/lang.py  |   60 -
 .../3rdparty/pykickstart/commands/langsupport.py   |   58 -
 .../mic/3rdparty/pykickstart/commands/lilocheck.py |   54 -
 .../mic/3rdparty/pykickstart/commands/logging.py   |   66 -
 .../mic/3rdparty/pykickstart/commands/logvol.py    |  304 ----
 .../3rdparty/pykickstart/commands/mediacheck.py    |   53 -
 .../mic/3rdparty/pykickstart/commands/method.py    |  186 ---
 .../mic/3rdparty/pykickstart/commands/monitor.py   |  106 --
 .../lib/mic/3rdparty/pykickstart/commands/mouse.py |   70 -
 .../mic/3rdparty/pykickstart/commands/multipath.py |  111 --
 .../mic/3rdparty/pykickstart/commands/network.py   |  363 -----
 .../lib/mic/3rdparty/pykickstart/commands/raid.py  |  365 -----
 .../mic/3rdparty/pykickstart/commands/reboot.py    |   79 --
 .../lib/mic/3rdparty/pykickstart/commands/repo.py  |  249 ----
 .../mic/3rdparty/pykickstart/commands/rescue.py    |   68 -
 .../mic/3rdparty/pykickstart/commands/rootpw.py    |   93 --
 .../mic/3rdparty/pykickstart/commands/selinux.py   |   64 -
 .../mic/3rdparty/pykickstart/commands/services.py  |   71 -
 .../lib/mic/3rdparty/pykickstart/commands/skipx.py |   54 -
 .../lib/mic/3rdparty/pykickstart/commands/sshpw.py |  105 --
 .../mic/3rdparty/pykickstart/commands/timezone.py  |   86 --
 .../mic/3rdparty/pykickstart/commands/updates.py   |   60 -
 .../mic/3rdparty/pykickstart/commands/upgrade.py   |  106 --
 .../lib/mic/3rdparty/pykickstart/commands/user.py  |  173 ---
 .../lib/mic/3rdparty/pykickstart/commands/vnc.py   |  114 --
 .../mic/3rdparty/pykickstart/commands/volgroup.py  |  102 --
 .../mic/3rdparty/pykickstart/commands/xconfig.py   |  184 ---
 .../mic/3rdparty/pykickstart/commands/zerombr.py   |   69 -
 .../lib/mic/3rdparty/pykickstart/commands/zfcp.py  |  134 --
 .../mic/3rdparty/pykickstart/handlers/control.py   | 1307 -----------------
 .../lib/mic/3rdparty/pykickstart/handlers/f10.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/f13.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/f14.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/f15.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/f7.py    |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/f8.py    |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/f9.py    |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/fc3.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/fc4.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/fc5.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/fc6.py   |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/rhel3.py |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/rhel4.py |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/rhel5.py |   24 -
 .../lib/mic/3rdparty/pykickstart/handlers/rhel6.py |   24 -
 .../3rdparty/pykickstart/urlgrabber/__init__.py    |   53 -
 .../3rdparty/pykickstart/urlgrabber/byterange.py   |  463 ------
 .../mic/3rdparty/pykickstart/urlgrabber/grabber.py | 1477 --------------------
 .../3rdparty/pykickstart/urlgrabber/keepalive.py   |  617 --------
 .../mic/3rdparty/pykickstart/urlgrabber/mirror.py  |  458 ------
 .../3rdparty/pykickstart/urlgrabber/progress.py    |  530 -------
 .../3rdparty/pykickstart/urlgrabber/sslfactory.py  |   90 --
 scripts/lib/mic/__version__.py                     |    1 -
 scripts/lib/mic/bootstrap.py                       |  279 ----
 scripts/lib/mic/chroot.py                          |  343 -----
 scripts/lib/mic/imager/baseimager.py               | 1263 -----------------
 scripts/lib/mic/imager/fs.py                       |   99 --
 scripts/lib/mic/imager/livecd.py                   |  750 ----------
 scripts/lib/mic/imager/liveusb.py                  |  308 ----
 scripts/lib/mic/imager/loop.py                     |  418 ------
 scripts/lib/mic/imager/raw.py                      |  501 -------
 scripts/lib/mic/kickstart/__init__.py              |  892 ------------
 .../lib/mic/kickstart/custom_commands/desktop.py   |   95 --
 .../mic/kickstart/custom_commands/installerfw.py   |   63 -
 .../lib/mic/kickstart/custom_commands/micrepo.py   |  127 --
 scripts/lib/mic/plugins/backend/yumpkgmgr.py       |  490 -------
 scripts/lib/mic/plugins/backend/zypppkgmgr.py      |  973 -------------
 scripts/lib/mic/plugins/hook/.py                   |    0
 scripts/lib/mic/plugins/hook/empty_hook.py         |    3 -
 scripts/lib/mic/plugins/imager/fs_plugin.py        |  143 --
 scripts/lib/mic/plugins/imager/livecd_plugin.py    |  255 ----
 scripts/lib/mic/plugins/imager/liveusb_plugin.py   |  260 ----
 scripts/lib/mic/plugins/imager/loop_plugin.py      |  255 ----
 scripts/lib/mic/plugins/imager/raw_plugin.py       |  275 ----
 scripts/lib/mic/rt_util.py                         |  223 ---
 scripts/lib/mic/utils/BmapCreate.py                |  298 ----
 scripts/lib/mic/utils/Fiemap.py                    |  252 ----
 scripts/lib/mic/utils/fs_related.py                | 1060 --------------
 scripts/lib/mic/utils/gpt_parser.py                |  331 -----
 scripts/lib/mic/utils/grabber.py                   |   97 --
 scripts/lib/mic/utils/misc.py                      | 1065 --------------
 scripts/lib/mic/utils/partitionedfs.py             |  782 -----------
 scripts/lib/mic/utils/proxy.py                     |  183 ---
 scripts/lib/mic/utils/rpmmisc.py                   |  600 --------
 .../{mic => wic}/3rdparty/pykickstart/__init__.py  |    0
 .../lib/{mic => wic}/3rdparty/pykickstart/base.py  |    0
 .../3rdparty/pykickstart/commands/__init__.py}     |    6 +-
 .../3rdparty/pykickstart/commands/bootloader.py    |   49 -
 .../3rdparty/pykickstart/commands/partition.py     |   39 -
 .../{mic => wic}/3rdparty/pykickstart/constants.py |    0
 .../{mic => wic}/3rdparty/pykickstart/errors.py    |    0
 .../3rdparty/pykickstart/handlers/__init__.py      |    0
 .../3rdparty/pykickstart/handlers/control.py}      |   30 +-
 .../3rdparty/pykickstart/handlers/f16.py           |    0
 .../lib/{mic => wic}/3rdparty/pykickstart/ko.py    |    0
 .../{mic => wic}/3rdparty/pykickstart/options.py   |    0
 .../{mic => wic}/3rdparty/pykickstart/parser.py    |    0
 .../{mic => wic}/3rdparty/pykickstart/sections.py  |    0
 .../{mic => wic}/3rdparty/pykickstart/version.py   |    0
 scripts/lib/{mic => wic}/__init__.py               |    0
 scripts/lib/wic/__version__.py                     |    1 +
 scripts/lib/{mic => wic}/conf.py                   |  107 +-
 scripts/lib/{mic => wic}/creator.py                |  188 +--
 scripts/lib/{mic => wic}/imager/__init__.py        |    0
 scripts/lib/wic/imager/baseimager.py               |  193 +++
 scripts/lib/{mic => wic}/imager/direct.py          |  133 +-
 scripts/lib/wic/kickstart/__init__.py              |  125 ++
 .../kickstart/custom_commands/__init__.py          |    7 -
 .../kickstart/custom_commands/micboot.py           |    0
 .../kickstart/custom_commands/micpartition.py      |    0
 .../kickstart/custom_commands/partition.py         |   50 +-
 .../kickstart/custom_commands/wicboot.py           |    2 +-
 scripts/lib/{mic => wic}/msger.py                  |    0
 scripts/lib/{mic => wic}/plugin.py                 |   18 +-
 scripts/lib/{mic => wic}/pluginbase.py             |   65 +-
 .../{mic => wic}/plugins/imager/direct_plugin.py   |   27 +-
 .../lib/{mic => wic}/plugins/source/bootimg-efi.py |   29 +-
 .../{mic => wic}/plugins/source/bootimg-pcbios.py  |   37 +-
 scripts/lib/{mic => wic}/plugins/source/rootfs.py  |   17 +-
 scripts/lib/{mic => wic}/test                      |    0
 scripts/lib/{mic => wic}/utils/__init__.py         |    0
 scripts/lib/{mic => wic}/utils/cmdln.py            |    0
 scripts/lib/{mic => wic}/utils/errors.py           |   26 +-
 scripts/lib/wic/utils/fs_related.py                |  111 ++
 scripts/lib/wic/utils/misc.py                      |   59 +
 scripts/lib/{mic => wic}/utils/oe/__init__.py      |    2 +-
 scripts/lib/{mic => wic}/utils/oe/misc.py          |   39 +-
 scripts/lib/wic/utils/partitionedfs.py             |  360 +++++
 scripts/lib/{mic => wic}/utils/runner.py           |    2 +-
 152 files changed, 1078 insertions(+), 24119 deletions(-)
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/authconfig.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/autopart.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/autostep.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/clearpart.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/device.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/deviceprobe.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/displaymode.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/dmraid.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/driverdisk.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/fcoe.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/firewall.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/firstboot.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/group.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/ignoredisk.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/interactive.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/iscsiname.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/key.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/keyboard.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/lang.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/langsupport.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/lilocheck.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/logging.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/logvol.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/mediacheck.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/method.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/mouse.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/multipath.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/network.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/raid.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/repo.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/rescue.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/rootpw.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/selinux.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/services.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/skipx.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/sshpw.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/timezone.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/updates.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/upgrade.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/user.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/volgroup.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/zerombr.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/control.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f10.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f13.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f14.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f15.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f7.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f8.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/f9.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc3.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc4.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc5.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/fc6.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel3.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel4.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel5.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/handlers/rhel6.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/__init__.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/byterange.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/grabber.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/keepalive.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/mirror.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/progress.py
 delete mode 100644 scripts/lib/mic/3rdparty/pykickstart/urlgrabber/sslfactory.py
 delete mode 100644 scripts/lib/mic/__version__.py
 delete mode 100644 scripts/lib/mic/bootstrap.py
 delete mode 100644 scripts/lib/mic/chroot.py
 delete mode 100644 scripts/lib/mic/imager/baseimager.py
 delete mode 100644 scripts/lib/mic/imager/fs.py
 delete mode 100644 scripts/lib/mic/imager/livecd.py
 delete mode 100644 scripts/lib/mic/imager/liveusb.py
 delete mode 100644 scripts/lib/mic/imager/loop.py
 delete mode 100644 scripts/lib/mic/imager/raw.py
 delete mode 100644 scripts/lib/mic/kickstart/__init__.py
 delete mode 100644 scripts/lib/mic/kickstart/custom_commands/desktop.py
 delete mode 100644 scripts/lib/mic/kickstart/custom_commands/installerfw.py
 delete mode 100644 scripts/lib/mic/kickstart/custom_commands/micrepo.py
 delete mode 100644 scripts/lib/mic/plugins/backend/yumpkgmgr.py
 delete mode 100755 scripts/lib/mic/plugins/backend/zypppkgmgr.py
 delete mode 100644 scripts/lib/mic/plugins/hook/.py
 delete mode 100644 scripts/lib/mic/plugins/hook/empty_hook.py
 delete mode 100644 scripts/lib/mic/plugins/imager/fs_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/livecd_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/liveusb_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/loop_plugin.py
 delete mode 100644 scripts/lib/mic/plugins/imager/raw_plugin.py
 delete mode 100644 scripts/lib/mic/rt_util.py
 delete mode 100644 scripts/lib/mic/utils/BmapCreate.py
 delete mode 100644 scripts/lib/mic/utils/Fiemap.py
 delete mode 100644 scripts/lib/mic/utils/fs_related.py
 delete mode 100644 scripts/lib/mic/utils/gpt_parser.py
 delete mode 100644 scripts/lib/mic/utils/grabber.py
 delete mode 100644 scripts/lib/mic/utils/misc.py
 delete mode 100644 scripts/lib/mic/utils/partitionedfs.py
 delete mode 100644 scripts/lib/mic/utils/proxy.py
 delete mode 100644 scripts/lib/mic/utils/rpmmisc.py
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/__init__.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/base.py (100%)
 rename scripts/lib/{mic/3rdparty/pykickstart/handlers/f12.py => wic/3rdparty/pykickstart/commands/__init__.py} (89%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/commands/bootloader.py (83%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/commands/partition.py (89%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/constants.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/errors.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/handlers/__init__.py (100%)
 rename scripts/lib/{mic/3rdparty/pykickstart/handlers/f11.py => wic/3rdparty/pykickstart/handlers/control.py} (47%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/handlers/f16.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/ko.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/options.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/parser.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/sections.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/version.py (100%)
 rename scripts/lib/{mic => wic}/__init__.py (100%)
 create mode 100644 scripts/lib/wic/__version__.py
 rename scripts/lib/{mic => wic}/conf.py (44%)
 rename scripts/lib/{mic => wic}/creator.py (41%)
 rename scripts/lib/{mic => wic}/imager/__init__.py (100%)
 create mode 100644 scripts/lib/wic/imager/baseimager.py
 rename scripts/lib/{mic => wic}/imager/direct.py (72%)
 create mode 100644 scripts/lib/wic/kickstart/__init__.py
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/__init__.py (52%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/micboot.py (100%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/micpartition.py (100%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/partition.py (93%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/wicboot.py (97%)
 rename scripts/lib/{mic => wic}/msger.py (100%)
 rename scripts/lib/{mic => wic}/plugin.py (93%)
 rename scripts/lib/{mic => wic}/pluginbase.py (66%)
 rename scripts/lib/{mic => wic}/plugins/imager/direct_plugin.py (77%)
 rename scripts/lib/{mic => wic}/plugins/source/bootimg-efi.py (88%)
 rename scripts/lib/{mic => wic}/plugins/source/bootimg-pcbios.py (87%)
 rename scripts/lib/{mic => wic}/plugins/source/rootfs.py (88%)
 rename scripts/lib/{mic => wic}/test (100%)
 rename scripts/lib/{mic => wic}/utils/__init__.py (100%)
 rename scripts/lib/{mic => wic}/utils/cmdln.py (100%)
 rename scripts/lib/{mic => wic}/utils/errors.py (75%)
 create mode 100644 scripts/lib/wic/utils/fs_related.py
 create mode 100644 scripts/lib/wic/utils/misc.py
 rename scripts/lib/{mic => wic}/utils/oe/__init__.py (95%)
 rename scripts/lib/{mic => wic}/utils/oe/misc.py (85%)
 create mode 100644 scripts/lib/wic/utils/partitionedfs.py
 rename scripts/lib/{mic => wic}/utils/runner.py (99%)

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 29/35] wic: Update/rename install-related code
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (27 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 28/35] wic: Update cleanup/unmount-related code Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 30/35] wic: Update/rename configure-related code Tom Zanussi
                   ` (5 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

The wic code inherited a basic image-creation flow based on installing
packages, but wic doesn't actually install anything, so rename parts
of the code dealing with installing to something more appropriate.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/direct.py                | 50 ++++++++++++-------------
 scripts/lib/mic/plugins/imager/direct_plugin.py |  2 +-
 scripts/lib/mic/utils/partitionedfs.py          | 16 ++++----
 3 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 91f64d5..8d7b6ee 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -62,7 +62,7 @@ class DirectImageCreator(BaseImageCreator):
         """
         BaseImageCreator.__init__(self, creatoropts)
 
-        self.__instimage = None
+        self.__image = None
         self.__disks = {}
         self.__disk_format = "direct"
         self._disk_names = []
@@ -226,7 +226,7 @@ class DirectImageCreator(BaseImageCreator):
         """
         parts = self._get_parts()
 
-        self.__instimage = PartitionedMount()
+        self.__image = PartitionedMount()
 
         for p in parts:
             # as a convenience, set source to the boot partition source
@@ -250,39 +250,39 @@ class DirectImageCreator(BaseImageCreator):
 
             self._restore_fstab(fstab)
 
-            self.__instimage.add_partition(int(p.size),
-                                           p.disk,
-                                           p.mountpoint,
-                                           p.source_file,
-                                           p.fstype,
-                                           p.label,
-                                           fsopts = p.fsopts,
-                                           boot = p.active,
-                                           align = p.align,
-                                           part_type = p.part_type)
+            self.__image.add_partition(int(p.size),
+                                       p.disk,
+                                       p.mountpoint,
+                                       p.source_file,
+                                       p.fstype,
+                                       p.label,
+                                       fsopts = p.fsopts,
+                                       boot = p.active,
+                                       align = p.align,
+                                       part_type = p.part_type)
 
-        self.__instimage.layout_partitions(self._ptable_format)
+        self.__image.layout_partitions(self._ptable_format)
 
         self.__imgdir = self.workdir
-        for disk_name, disk in self.__instimage.disks.items():
+        for disk_name, disk in self.__image.disks.items():
             full_path = self._full_path(self.__imgdir, disk_name, "direct")
             msger.debug("Adding disk %s as %s with size %s bytes" \
                         % (disk_name, full_path, disk['min_size']))
             disk_obj = fs_related.DiskImage(full_path, disk['min_size'])
             self.__disks[disk_name] = disk_obj
-            self.__instimage.add_disk(disk_name, disk_obj)
+            self.__image.add_disk(disk_name, disk_obj)
 
-        self.__instimage.create()
+        self.__image.create()
 
-    def install(self):
+    def assemble(self):
         """
-        Install fs images into partitions
+        Assemble partitions into disk image(s)
         """
-        for disk_name, disk in self.__instimage.disks.items():
+        for disk_name, disk in self.__image.disks.items():
             full_path = self._full_path(self.__imgdir, disk_name, "direct")
-            msger.debug("Installing disk %s as %s with size %s bytes" \
+            msger.debug("Assembling disk %s as %s with size %s bytes" \
                         % (disk_name, full_path, disk['min_size']))
-            self.__instimage.install(full_path)
+            self.__image.assemble(full_path)
 
     def configure(self):
         """
@@ -294,7 +294,7 @@ class DirectImageCreator(BaseImageCreator):
         source_plugin = self.get_default_source_plugin()
         if source_plugin:
             self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods)
-            for disk_name, disk in self.__instimage.disks.items():
+            for disk_name, disk in self.__image.disks.items():
                 self._source_methods["do_install_disk"](disk, disk_name, self,
                                                         self.workdir,
                                                         self.oe_builddir,
@@ -310,7 +310,7 @@ class DirectImageCreator(BaseImageCreator):
 
         parts = self._get_parts()
 
-        for disk_name, disk in self.__instimage.disks.items():
+        for disk_name, disk in self.__image.disks.items():
             full_path = self._full_path(self.__imgdir, disk_name, "direct")
             msg += '  %s\n\n' % full_path
 
@@ -355,9 +355,9 @@ class DirectImageCreator(BaseImageCreator):
         return (rootdev, root_part_uuid)
 
     def _cleanup(self):
-        if not self.__instimage is None:
+        if not self.__image is None:
             try:
-                self.__instimage.cleanup()
+                self.__image.cleanup()
             except MountError, err:
                 msger.warning("%s" % err)
 
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py
index da18b65..2cbd5d1 100644
--- a/scripts/lib/mic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/mic/plugins/imager/direct_plugin.py
@@ -92,7 +92,7 @@ class DirectPlugin(ImagerPlugin):
 
         try:
             creator.create()
-            creator.install()
+            creator.assemble()
             creator.configure()
             creator.print_outimage_info()
 
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index 43a38a9..2f950a6 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -309,11 +309,11 @@ class PartitionedMount:
                 except:
                     pass
 
-    def __install_partition(self, num, source_file, start, size):
+    def __write_partition(self, num, source_file, start, size):
         """
         Install source_file contents into a partition.
         """
-        if not source_file: # nothing to install
+        if not source_file: # nothing to write
             return
 
         # Start is included in the size so need to substract one from the end.
@@ -325,7 +325,7 @@ class PartitionedMount:
         exec_cmd(dd_cmd)
 
 
-    def install(self, image_file):
+    def assemble(self, image_file):
         msger.debug("Installing partitions")
 
         self.image_file = image_file
@@ -337,12 +337,12 @@ class PartitionedMount:
                 # of the first _logical_ partition. This is why the extended
                 # partition should start one sector before the first logical
                 # partition.
-                self.__install_partition(p['num'], p['source_file'],
-                                         p['start'] - 1,
-                                         d['offset'] - p['start'])
+                self.__write_partition(p['num'], p['source_file'],
+                                       p['start'] - 1,
+                                       d['offset'] - p['start'])
 
-            self.__install_partition(p['num'], p['source_file'],
-                                     p['start'], p['size'])
+            self.__write_partition(p['num'], p['source_file'],
+                                   p['start'], p['size'])
 
     def create(self):
         for dev in self.disks.keys():
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 30/35] wic: Update/rename configure-related code
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (28 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 29/35] wic: Update/rename install-related code Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 31/35] wic: Rename PartitionedMount Tom Zanussi
                   ` (4 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

The wic code inherited a basic image-creation flow based on
image-configuration, but wic doesn't actually configure anything, so
rename parts of the code dealing with configuration to something more
appropriate.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/direct.py                | 7 ++++---
 scripts/lib/mic/plugins/imager/direct_plugin.py | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 8d7b6ee..17bfd01 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -284,12 +284,13 @@ class DirectImageCreator(BaseImageCreator):
                         % (disk_name, full_path, disk['min_size']))
             self.__image.assemble(full_path)
 
-    def configure(self):
+    def finalize(self):
         """
-        Configure the system image according to kickstart.
+        Finalize the disk image.
 
-        For now, it just prepares the image to be bootable by e.g.
+        For example, prepare the image to be bootable by e.g.
         creating and installing a bootloader configuration.
+
         """
         source_plugin = self.get_default_source_plugin()
         if source_plugin:
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py
index 2cbd5d1..ff30f09 100644
--- a/scripts/lib/mic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/mic/plugins/imager/direct_plugin.py
@@ -93,7 +93,7 @@ class DirectPlugin(ImagerPlugin):
         try:
             creator.create()
             creator.assemble()
-            creator.configure()
+            creator.finalize()
             creator.print_outimage_info()
 
         except errors.CreatorError:
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 31/35] wic: Rename PartitionedMount
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (29 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 30/35] wic: Update/rename configure-related code Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 32/35] wic: Rename MountError Tom Zanussi
                   ` (3 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

It's actually a container for disks and partitions, and wic doesn't
mount anything, so rename it to match what it really is.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/direct.py                 | 15 +++++++--------
 scripts/lib/mic/plugins/imager/direct_plugin.py  |  1 -
 scripts/lib/mic/plugins/source/bootimg-efi.py    |  1 -
 scripts/lib/mic/plugins/source/bootimg-pcbios.py |  1 -
 scripts/lib/mic/plugins/source/rootfs.py         |  1 -
 scripts/lib/mic/utils/partitionedfs.py           |  8 +++++++-
 6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 17bfd01..a4f5691 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -31,7 +31,7 @@ import shutil
 
 from mic import kickstart, msger
 from mic.utils import fs_related, runner, misc
-from mic.utils.partitionedfs import PartitionedMount
+from mic.utils.partitionedfs import Image
 from mic.utils.errors import CreatorError, MountError
 from mic.imager.baseimager import BaseImageCreator
 from mic.utils.oe.misc import *
@@ -226,7 +226,7 @@ class DirectImageCreator(BaseImageCreator):
         """
         parts = self._get_parts()
 
-        self.__image = PartitionedMount()
+        self.__image = Image()
 
         for p in parts:
             # as a convenience, set source to the boot partition source
@@ -237,12 +237,11 @@ class DirectImageCreator(BaseImageCreator):
         for p in parts:
             # need to create the filesystems in order to get their
             # sizes before we can add them and do the layout.
-            # PartitionedMount.create() actually calls __format_disks()
-            # to create the disk images and carve out the partitions,
-            # then self.install() calls PartitionedMount.install()
-            # which calls __install_partitition() for each partition
-            # to dd the fs into the partitions.
-
+            # Image.create() actually calls __format_disks() to create
+            # the disk images and carve out the partitions, then
+            # self.assemble() calls Image.assemble() which calls
+            # __write_partitition() for each partition to dd the fs
+            # into the partitions.
             fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
 
             p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir,
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py
index ff30f09..c05a400 100644
--- a/scripts/lib/mic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/mic/plugins/imager/direct_plugin.py
@@ -34,7 +34,6 @@ from mic import msger
 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
 
 import mic.imager.direct as direct
 from mic.pluginbase import ImagerPlugin
diff --git a/scripts/lib/mic/plugins/source/bootimg-efi.py b/scripts/lib/mic/plugins/source/bootimg-efi.py
index d4a7771..e880358 100644
--- a/scripts/lib/mic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/mic/plugins/source/bootimg-efi.py
@@ -33,7 +33,6 @@ from mic import kickstart, msger
 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
 import mic.imager.direct as direct
 from mic.pluginbase import SourcePlugin
 from mic.utils.oe.misc import *
diff --git a/scripts/lib/mic/plugins/source/bootimg-pcbios.py b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
index 3434320..53ed7c3 100644
--- a/scripts/lib/mic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
@@ -33,7 +33,6 @@ from mic import kickstart, msger
 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
 import mic.imager.direct as direct
 from mic.pluginbase import SourcePlugin
 from mic.utils.oe.misc import *
diff --git a/scripts/lib/mic/plugins/source/rootfs.py b/scripts/lib/mic/plugins/source/rootfs.py
index 8cb576d..8ebf62c 100644
--- a/scripts/lib/mic/plugins/source/rootfs.py
+++ b/scripts/lib/mic/plugins/source/rootfs.py
@@ -34,7 +34,6 @@ from mic import kickstart, msger
 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
 import mic.imager.direct as direct
 from mic.pluginbase import SourcePlugin
 from mic.utils.oe.misc import *
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index 2f950a6..f4ce4a9 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -32,7 +32,13 @@ MBR_OVERHEAD = 1
 # Size of a sector in bytes
 SECTOR_SIZE = 512
 
-class PartitionedMount:
+class Image:
+    """
+    Generic base object for an image.
+
+    An Image is a container for a set of DiskImages and associated
+    partitions.
+    """
     def __init__(self):
         self.disks = {}
         self.partitions = []
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 32/35] wic: Rename MountError
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (30 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 31/35] wic: Rename PartitionedMount Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 33/35] wic: Update Disk description Tom Zanussi
                   ` (2 subsequent siblings)
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

wic doesn't mount anything, so can't have a mount error; rename it to
something more appropriate.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/imager/direct.py                 | 4 ++--
 scripts/lib/mic/plugins/source/bootimg-efi.py    | 2 +-
 scripts/lib/mic/plugins/source/bootimg-pcbios.py | 4 ++--
 scripts/lib/mic/utils/errors.py                  | 5 +----
 scripts/lib/mic/utils/partitionedfs.py           | 8 ++++----
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index a4f5691..2f2bd4e 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -32,7 +32,7 @@ import shutil
 from mic import kickstart, msger
 from mic.utils import fs_related, runner, misc
 from mic.utils.partitionedfs import Image
-from mic.utils.errors import CreatorError, MountError
+from mic.utils.errors import CreatorError, ImageError
 from mic.imager.baseimager import BaseImageCreator
 from mic.utils.oe.misc import *
 from mic.plugin import pluginmgr
@@ -358,6 +358,6 @@ class DirectImageCreator(BaseImageCreator):
         if not self.__image is None:
             try:
                 self.__image.cleanup()
-            except MountError, err:
+            except ImageError, err:
                 msger.warning("%s" % err)
 
diff --git a/scripts/lib/mic/plugins/source/bootimg-efi.py b/scripts/lib/mic/plugins/source/bootimg-efi.py
index e880358..5b1a533 100644
--- a/scripts/lib/mic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/mic/plugins/source/bootimg-efi.py
@@ -77,7 +77,7 @@ class BootimgEFIPlugin(SourcePlugin):
         if cr._ptable_format == 'msdos':
             rootstr = rootdev
         else:
-            raise MountError("Unsupported partition table format found")
+            raise ImageError("Unsupported partition table format found")
 
         grubefi_conf += "linux %s root=%s rootwait %s\n" \
             % (kernel, rootstr, options)
diff --git a/scripts/lib/mic/plugins/source/bootimg-pcbios.py b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
index 53ed7c3..959cf41 100644
--- a/scripts/lib/mic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/mic/plugins/source/bootimg-pcbios.py
@@ -62,7 +62,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         rc = runner.show(['dd', 'if=%s' % mbrfile,
                           'of=%s' % full_path, 'conv=notrunc'])
         if rc != 0:
-            raise MountError("Unable to set MBR to %s" % full_path)
+            raise ImageError("Unable to set MBR to %s" % full_path)
 
     @classmethod
     def do_configure_partition(self, part, cr, cr_workdir, oe_builddir,
@@ -107,7 +107,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         if cr._ptable_format == 'msdos':
             rootstr = rootdev
         else:
-            raise MountError("Unsupported partition table format found")
+            raise ImageError("Unsupported partition table format found")
 
         syslinux_conf += "APPEND label=boot root=%s %s\n" % (rootstr, options)
 
diff --git a/scripts/lib/mic/utils/errors.py b/scripts/lib/mic/utils/errors.py
index 38fda30..86e230a 100644
--- a/scripts/lib/mic/utils/errors.py
+++ b/scripts/lib/mic/utils/errors.py
@@ -40,11 +40,8 @@ class Usage(CreatorError):
             self.msg = str(self.msg)
         return self.keyword + self.msg + ', please use "--help" for more info'
 
-class Abort(CreatorError):
-    keyword = ''
-
 class KsError(CreatorError):
     keyword = '<kickstart>'
 
-class MountError(CreatorError):
+class ImageError(CreatorError):
     keyword = '<mount>'
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index f4ce4a9..68e4cab 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -22,7 +22,7 @@ import os
 
 from mic import msger
 from mic.utils import runner
-from mic.utils.errors import MountError
+from mic.utils.errors import ImageError
 from mic.utils.fs_related import *
 from mic.utils.oe.misc import *
 
@@ -121,7 +121,7 @@ class Image:
         msger.debug("Assigning %s partitions to disks" % ptable_format)
 
         if ptable_format not in ('msdos'):
-            raise MountError("Unknown partition table format '%s', supported " \
+            raise ImageError("Unknown partition table format '%s', supported " \
                              "formats are: 'msdos'" % ptable_format)
 
         if self._partitions_layed_out:
@@ -134,14 +134,14 @@ class Image:
             p = self.partitions[n]
 
             if not self.disks.has_key(p['disk_name']):
-                raise MountError("No disk %s for partition %s" \
+                raise ImageError("No disk %s for partition %s" \
                                  % (p['disk_name'], p['mountpoint']))
 
             if p['part_type']:
                 # The --part-type can also be implemented for MBR partitions,
                 # in which case it would map to the 1-byte "partition type"
                 # filed at offset 3 of the partition entry.
-                raise MountError("setting custom partition type is not " \
+                raise ImageError("setting custom partition type is not " \
                                  "implemented for msdos partitions")
 
             # Get the disk where the partition is located
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 33/35] wic: Update Disk description
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (31 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 32/35] wic: Rename MountError Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:05 ` [PATCH 34/35] wic: Rename /mic to /wic Tom Zanussi
  2014-08-08 22:06 ` [PATCH 35/35] wic: Bump the version to 2.0 Tom Zanussi
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

Remove obsolete comment.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/fs_related.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/mic/utils/fs_related.py
index 07a5ff9..cf2a759 100644
--- a/scripts/lib/mic/utils/fs_related.py
+++ b/scripts/lib/mic/utils/fs_related.py
@@ -60,11 +60,8 @@ def makedirs(dirname):
             raise
 
 class Disk:
-    """Generic base object for a disk
-
-    The 'create' method must make the disk visible as a block device - eg
-    by calling losetup. For RawDisk, this is obviously a no-op. The 'cleanup'
-    method must undo the 'create' operation.
+    """
+    Generic base object for a disk.
     """
     def __init__(self, size, device = None):
         self._device = device
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 34/35] wic: Rename /mic to /wic
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (32 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 33/35] wic: Update Disk description Tom Zanussi
@ 2014-08-08 22:05 ` Tom Zanussi
  2014-08-08 22:06 ` [PATCH 35/35] wic: Bump the version to 2.0 Tom Zanussi
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

As well as any other stray instances of mic in the codebase that can
be removed.

We don't really need to carry around legacy naming, and the history is
in git.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/image/engine.py                          | 12 ++++++------
 scripts/lib/image/help.py                            |  8 ++++----
 .../{mic => wic}/3rdparty/pykickstart/__init__.py    |  0
 .../lib/{mic => wic}/3rdparty/pykickstart/base.py    |  0
 .../3rdparty/pykickstart/commands/__init__.py        |  0
 .../3rdparty/pykickstart/commands/bootloader.py      |  0
 .../3rdparty/pykickstart/commands/partition.py       |  0
 .../{mic => wic}/3rdparty/pykickstart/constants.py   |  0
 .../lib/{mic => wic}/3rdparty/pykickstart/errors.py  |  0
 .../3rdparty/pykickstart/handlers/__init__.py        |  0
 .../3rdparty/pykickstart/handlers/control.py         |  0
 .../3rdparty/pykickstart/handlers/f16.py             |  0
 scripts/lib/{mic => wic}/3rdparty/pykickstart/ko.py  |  0
 .../lib/{mic => wic}/3rdparty/pykickstart/options.py |  0
 .../lib/{mic => wic}/3rdparty/pykickstart/parser.py  |  0
 .../{mic => wic}/3rdparty/pykickstart/sections.py    |  0
 .../lib/{mic => wic}/3rdparty/pykickstart/version.py |  0
 scripts/lib/{mic => wic}/__init__.py                 |  0
 scripts/lib/{mic => wic}/__version__.py              |  0
 scripts/lib/{mic => wic}/conf.py                     | 12 ++++++------
 scripts/lib/{mic => wic}/creator.py                  | 12 ++++++------
 scripts/lib/{mic => wic}/imager/__init__.py          |  0
 scripts/lib/{mic => wic}/imager/baseimager.py        | 10 +++++-----
 scripts/lib/{mic => wic}/imager/direct.py            | 17 ++++++++---------
 scripts/lib/{mic => wic}/kickstart/__init__.py       |  4 ++--
 .../kickstart/custom_commands/__init__.py            |  0
 .../kickstart/custom_commands/micboot.py             |  0
 .../kickstart/custom_commands/micpartition.py        |  0
 .../kickstart/custom_commands/partition.py           |  6 +++---
 .../kickstart/custom_commands/wicboot.py             |  2 +-
 scripts/lib/{mic => wic}/msger.py                    |  0
 scripts/lib/{mic => wic}/plugin.py                   | 16 ++++++++--------
 scripts/lib/{mic => wic}/pluginbase.py               | 20 ++++++++++----------
 .../lib/{mic => wic}/plugins/imager/direct_plugin.py | 15 +++++++--------
 .../lib/{mic => wic}/plugins/source/bootimg-efi.py   | 16 ++++++++--------
 .../{mic => wic}/plugins/source/bootimg-pcbios.py    | 16 ++++++++--------
 scripts/lib/{mic => wic}/plugins/source/rootfs.py    | 16 ++++++++--------
 scripts/lib/{mic => wic}/test                        |  0
 scripts/lib/{mic => wic}/utils/__init__.py           |  0
 scripts/lib/{mic => wic}/utils/cmdln.py              |  0
 scripts/lib/{mic => wic}/utils/errors.py             |  0
 scripts/lib/{mic => wic}/utils/fs_related.py         |  8 ++++----
 scripts/lib/{mic => wic}/utils/misc.py               |  0
 scripts/lib/{mic => wic}/utils/oe/__init__.py        |  2 +-
 scripts/lib/{mic => wic}/utils/oe/misc.py            |  6 +++---
 scripts/lib/{mic => wic}/utils/partitionedfs.py      | 10 +++++-----
 scripts/lib/{mic => wic}/utils/runner.py             |  2 +-
 47 files changed, 104 insertions(+), 106 deletions(-)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/__init__.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/base.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/commands/__init__.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/commands/bootloader.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/commands/partition.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/constants.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/errors.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/handlers/__init__.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/handlers/control.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/handlers/f16.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/ko.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/options.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/parser.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/sections.py (100%)
 rename scripts/lib/{mic => wic}/3rdparty/pykickstart/version.py (100%)
 rename scripts/lib/{mic => wic}/__init__.py (100%)
 rename scripts/lib/{mic => wic}/__version__.py (100%)
 rename scripts/lib/{mic => wic}/conf.py (93%)
 rename scripts/lib/{mic => wic}/creator.py (96%)
 rename scripts/lib/{mic => wic}/imager/__init__.py (100%)
 rename scripts/lib/{mic => wic}/imager/baseimager.py (96%)
 rename scripts/lib/{mic => wic}/imager/direct.py (96%)
 rename scripts/lib/{mic => wic}/kickstart/__init__.py (98%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/__init__.py (100%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/micboot.py (100%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/micpartition.py (100%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/partition.py (99%)
 rename scripts/lib/{mic => wic}/kickstart/custom_commands/wicboot.py (97%)
 rename scripts/lib/{mic => wic}/msger.py (100%)
 rename scripts/lib/{mic => wic}/plugin.py (94%)
 rename scripts/lib/{mic => wic}/pluginbase.py (88%)
 rename scripts/lib/{mic => wic}/plugins/imager/direct_plugin.py (89%)
 rename scripts/lib/{mic => wic}/plugins/source/bootimg-efi.py (94%)
 rename scripts/lib/{mic => wic}/plugins/source/bootimg-pcbios.py (95%)
 rename scripts/lib/{mic => wic}/plugins/source/rootfs.py (90%)
 rename scripts/lib/{mic => wic}/test (100%)
 rename scripts/lib/{mic => wic}/utils/__init__.py (100%)
 rename scripts/lib/{mic => wic}/utils/cmdln.py (100%)
 rename scripts/lib/{mic => wic}/utils/errors.py (100%)
 rename scripts/lib/{mic => wic}/utils/fs_related.py (96%)
 rename scripts/lib/{mic => wic}/utils/misc.py (100%)
 rename scripts/lib/{mic => wic}/utils/oe/__init__.py (95%)
 rename scripts/lib/{mic => wic}/utils/oe/misc.py (97%)
 rename scripts/lib/{mic => wic}/utils/partitionedfs.py (98%)
 rename scripts/lib/{mic => wic}/utils/runner.py (99%)

diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index b850bb9..f1df8b4 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -37,12 +37,12 @@ import subprocess
 import shutil
 
 import os, sys, errno
-from mic import msger, creator
-from mic.utils import cmdln, misc, errors
-from mic.conf import configmgr
-from mic.plugin import pluginmgr
-from mic.__version__ import VERSION
-from mic.utils.oe.misc import *
+from wic import msger, creator
+from wic.utils import cmdln, misc, errors
+from wic.conf import configmgr
+from wic.plugin import pluginmgr
+from wic.__version__ import VERSION
+from wic.utils.oe.misc import *
 
 
 def verify_build_env():
diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py
index 6503aaa..080795e 100644
--- a/scripts/lib/image/help.py
+++ b/scripts/lib/image/help.py
@@ -144,7 +144,7 @@ DESCRIPTION
     the corresponding artifacts are typically found in a normal
     OpenEmbedded build.
 
-    Alternatively, users can use the -e option to have 'mic' determine
+    Alternatively, users can use the -e option to have 'wic' determine
     those locations for a given image.  If the -e option is used, the
     user needs to have set the appropriate MACHINE variable in
     local.conf, and have sourced the build environment.
@@ -349,12 +349,12 @@ DESCRIPTION
     implementation that populates a corresponding partition.
 
     A source plugin is created as a subclass of SourcePlugin (see
-    scripts/lib/mic/pluginbase.py) and the plugin file containing it
-    is added to scripts/lib/mic/plugins/source/ to make the plugin
+    scripts/lib/wic/pluginbase.py) and the plugin file containing it
+    is added to scripts/lib/wic/plugins/source/ to make the plugin
     implementation available to the wic implementation.
 
     Source plugins can also be implemented and added by external
-    layers - any plugins found in a scripts/lib/mic/plugins/source/
+    layers - any plugins found in a scripts/lib/wic/plugins/source/
     directory in an external layer will also be made available.
 
     When the wic implementation needs to invoke a partition-specific
diff --git a/scripts/lib/mic/3rdparty/pykickstart/__init__.py b/scripts/lib/wic/3rdparty/pykickstart/__init__.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/__init__.py
rename to scripts/lib/wic/3rdparty/pykickstart/__init__.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/base.py b/scripts/lib/wic/3rdparty/pykickstart/base.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/base.py
rename to scripts/lib/wic/3rdparty/pykickstart/base.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py b/scripts/lib/wic/3rdparty/pykickstart/commands/__init__.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py
rename to scripts/lib/wic/3rdparty/pykickstart/commands/__init__.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py b/scripts/lib/wic/3rdparty/pykickstart/commands/bootloader.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py
rename to scripts/lib/wic/3rdparty/pykickstart/commands/bootloader.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py b/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/commands/partition.py
rename to scripts/lib/wic/3rdparty/pykickstart/commands/partition.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/constants.py b/scripts/lib/wic/3rdparty/pykickstart/constants.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/constants.py
rename to scripts/lib/wic/3rdparty/pykickstart/constants.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/errors.py b/scripts/lib/wic/3rdparty/pykickstart/errors.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/errors.py
rename to scripts/lib/wic/3rdparty/pykickstart/errors.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/__init__.py b/scripts/lib/wic/3rdparty/pykickstart/handlers/__init__.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/handlers/__init__.py
rename to scripts/lib/wic/3rdparty/pykickstart/handlers/__init__.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/control.py b/scripts/lib/wic/3rdparty/pykickstart/handlers/control.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/handlers/control.py
rename to scripts/lib/wic/3rdparty/pykickstart/handlers/control.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/handlers/f16.py b/scripts/lib/wic/3rdparty/pykickstart/handlers/f16.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/handlers/f16.py
rename to scripts/lib/wic/3rdparty/pykickstart/handlers/f16.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/ko.py b/scripts/lib/wic/3rdparty/pykickstart/ko.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/ko.py
rename to scripts/lib/wic/3rdparty/pykickstart/ko.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/options.py b/scripts/lib/wic/3rdparty/pykickstart/options.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/options.py
rename to scripts/lib/wic/3rdparty/pykickstart/options.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/parser.py b/scripts/lib/wic/3rdparty/pykickstart/parser.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/parser.py
rename to scripts/lib/wic/3rdparty/pykickstart/parser.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/sections.py b/scripts/lib/wic/3rdparty/pykickstart/sections.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/sections.py
rename to scripts/lib/wic/3rdparty/pykickstart/sections.py
diff --git a/scripts/lib/mic/3rdparty/pykickstart/version.py b/scripts/lib/wic/3rdparty/pykickstart/version.py
similarity index 100%
rename from scripts/lib/mic/3rdparty/pykickstart/version.py
rename to scripts/lib/wic/3rdparty/pykickstart/version.py
diff --git a/scripts/lib/mic/__init__.py b/scripts/lib/wic/__init__.py
similarity index 100%
rename from scripts/lib/mic/__init__.py
rename to scripts/lib/wic/__init__.py
diff --git a/scripts/lib/mic/__version__.py b/scripts/lib/wic/__version__.py
similarity index 100%
rename from scripts/lib/mic/__version__.py
rename to scripts/lib/wic/__version__.py
diff --git a/scripts/lib/mic/conf.py b/scripts/lib/wic/conf.py
similarity index 93%
rename from scripts/lib/mic/conf.py
rename to scripts/lib/wic/conf.py
index a686e9c..d5419f8 100644
--- a/scripts/lib/mic/conf.py
+++ b/scripts/lib/wic/conf.py
@@ -18,15 +18,15 @@
 import os, sys, re
 import ConfigParser
 
-from mic import msger
-from mic import kickstart
-from mic.utils import misc, runner, errors
+from wic import msger
+from wic import kickstart
+from wic.utils import misc, runner, errors
 
 
 def get_siteconf():
-    mic_path = os.path.dirname(__file__)
-    eos = mic_path.find('scripts') + len('scripts')
-    scripts_path = mic_path[:eos]
+    wic_path = os.path.dirname(__file__)
+    eos = wic_path.find('scripts') + len('scripts')
+    scripts_path = wic_path[:eos]
 
     return scripts_path + "/lib/image/config/wic.conf"
 
diff --git a/scripts/lib/mic/creator.py b/scripts/lib/wic/creator.py
similarity index 96%
rename from scripts/lib/mic/creator.py
rename to scripts/lib/wic/creator.py
index 7c9ca6f..a4b19ac 100644
--- a/scripts/lib/mic/creator.py
+++ b/scripts/lib/wic/creator.py
@@ -18,10 +18,10 @@
 import os, sys, re
 from optparse import SUPPRESS_HELP
 
-from mic import msger
-from mic.utils import cmdln, errors
-from mic.conf import configmgr
-from mic.plugin import pluginmgr
+from wic import msger
+from wic.utils import cmdln, errors
+from wic.conf import configmgr
+from wic.plugin import pluginmgr
 
 
 class Creator(cmdln.Cmdln):
@@ -34,7 +34,7 @@ class Creator(cmdln.Cmdln):
     ${option_list}
     """
 
-    name = 'mic create(cr)'
+    name = 'wic create(cr)'
 
     def __init__(self, *args, **kwargs):
         cmdln.Cmdln.__init__(self, *args, **kwargs)
@@ -64,7 +64,7 @@ class Creator(cmdln.Cmdln):
                              help='Path of logfile')
         optparser.add_option('-c', '--config', type='string', dest='config',
                              default=None,
-                             help='Specify config file for mic')
+                             help='Specify config file for wic')
         optparser.add_option('-o', '--outdir', type='string', action='store',
                              dest='outdir', default=None,
                              help='Output directory')
diff --git a/scripts/lib/mic/imager/__init__.py b/scripts/lib/wic/imager/__init__.py
similarity index 100%
rename from scripts/lib/mic/imager/__init__.py
rename to scripts/lib/wic/imager/__init__.py
diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/wic/imager/baseimager.py
similarity index 96%
rename from scripts/lib/mic/imager/baseimager.py
rename to scripts/lib/wic/imager/baseimager.py
index 23919d4..5bcd2f7 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/wic/imager/baseimager.py
@@ -21,10 +21,10 @@ import os, sys
 import tempfile
 import shutil
 
-from mic import kickstart
-from mic import msger
-from mic.utils.errors import CreatorError
-from mic.utils import misc, runner, fs_related as fs
+from wic import kickstart
+from wic import msger
+from wic.utils.errors import CreatorError
+from wic.utils import misc, runner, fs_related as fs
 
 class BaseImageCreator(object):
     """Base class for image creation.
@@ -34,7 +34,7 @@ class BaseImageCreator(object):
 
     e.g.
 
-      import mic.imgcreate as imgcreate
+      import wic.imgcreate as imgcreate
       ks = imgcreate.read_kickstart("foo.ks")
       imgcreate.ImageCreator(ks, "foo").create()
     """
diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/wic/imager/direct.py
similarity index 96%
rename from scripts/lib/mic/imager/direct.py
rename to scripts/lib/wic/imager/direct.py
index 2f2bd4e..5b12856 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -18,8 +18,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 # DESCRIPTION
-# This implements the 'direct' image creator class for 'wic', based
-# loosely on the raw image creator from 'mic'
+# This implements the 'direct' image creator class for 'wic'
 #
 # AUTHORS
 # Tom Zanussi <tom.zanussi (at] linux.intel.com>
@@ -29,13 +28,13 @@ import os
 import stat
 import shutil
 
-from mic import kickstart, msger
-from mic.utils import fs_related, runner, misc
-from mic.utils.partitionedfs import Image
-from mic.utils.errors import CreatorError, ImageError
-from mic.imager.baseimager import BaseImageCreator
-from mic.utils.oe.misc import *
-from mic.plugin import pluginmgr
+from wic import kickstart, msger
+from wic.utils import fs_related, runner, misc
+from wic.utils.partitionedfs import Image
+from wic.utils.errors import CreatorError, ImageError
+from wic.imager.baseimager import BaseImageCreator
+from wic.utils.oe.misc import *
+from wic.plugin import pluginmgr
 
 disk_methods = {
     "do_install_disk":None,
diff --git a/scripts/lib/mic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py
similarity index 98%
rename from scripts/lib/mic/kickstart/__init__.py
rename to scripts/lib/wic/kickstart/__init__.py
index 590bf47..4f5b778 100644
--- a/scripts/lib/mic/kickstart/__init__.py
+++ b/scripts/lib/wic/kickstart/__init__.py
@@ -30,8 +30,8 @@ import pykickstart.version as ksversion
 from pykickstart.handlers.control import commandMap
 from pykickstart.handlers.control import dataMap
 
-from mic import msger
-from mic.utils import errors, misc, runner, fs_related as fs
+from wic import msger
+from wic.utils import errors, misc, runner, fs_related as fs
 from custom_commands import wicboot, partition
 
 def read_kickstart(path):
diff --git a/scripts/lib/mic/kickstart/custom_commands/__init__.py b/scripts/lib/wic/kickstart/custom_commands/__init__.py
similarity index 100%
rename from scripts/lib/mic/kickstart/custom_commands/__init__.py
rename to scripts/lib/wic/kickstart/custom_commands/__init__.py
diff --git a/scripts/lib/mic/kickstart/custom_commands/micboot.py b/scripts/lib/wic/kickstart/custom_commands/micboot.py
similarity index 100%
rename from scripts/lib/mic/kickstart/custom_commands/micboot.py
rename to scripts/lib/wic/kickstart/custom_commands/micboot.py
diff --git a/scripts/lib/mic/kickstart/custom_commands/micpartition.py b/scripts/lib/wic/kickstart/custom_commands/micpartition.py
similarity index 100%
rename from scripts/lib/mic/kickstart/custom_commands/micpartition.py
rename to scripts/lib/wic/kickstart/custom_commands/micpartition.py
diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
similarity index 99%
rename from scripts/lib/mic/kickstart/custom_commands/partition.py
rename to scripts/lib/wic/kickstart/custom_commands/partition.py
index 101b90e..24f523a 100644
--- a/scripts/lib/mic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -29,9 +29,9 @@ import os
 import tempfile
 
 from pykickstart.commands.partition import *
-from mic.utils.oe.misc import *
-from mic.kickstart.custom_commands import *
-from mic.plugin import pluginmgr
+from wic.utils.oe.misc import *
+from wic.kickstart.custom_commands import *
+from wic.plugin import pluginmgr
 
 partition_methods = {
     "do_stage_partition":None,
diff --git a/scripts/lib/mic/kickstart/custom_commands/wicboot.py b/scripts/lib/wic/kickstart/custom_commands/wicboot.py
similarity index 97%
rename from scripts/lib/mic/kickstart/custom_commands/wicboot.py
rename to scripts/lib/wic/kickstart/custom_commands/wicboot.py
index ab8871d..f191416 100644
--- a/scripts/lib/mic/kickstart/custom_commands/wicboot.py
+++ b/scripts/lib/wic/kickstart/custom_commands/wicboot.py
@@ -29,7 +29,7 @@ from pykickstart.errors import *
 from pykickstart.options import *
 from pykickstart.commands.bootloader import *
 
-from mic.kickstart.custom_commands.micboot import *
+from wic.kickstart.custom_commands.micboot import *
 
 class Wic_Bootloader(Mic_Bootloader):
     def __init__(self, writePriority=10, appendLine="", driveorder=None,
diff --git a/scripts/lib/mic/msger.py b/scripts/lib/wic/msger.py
similarity index 100%
rename from scripts/lib/mic/msger.py
rename to scripts/lib/wic/msger.py
diff --git a/scripts/lib/mic/plugin.py b/scripts/lib/wic/plugin.py
similarity index 94%
rename from scripts/lib/mic/plugin.py
rename to scripts/lib/wic/plugin.py
index 43afdbc..61c5859 100644
--- a/scripts/lib/mic/plugin.py
+++ b/scripts/lib/wic/plugin.py
@@ -17,16 +17,16 @@
 
 import os, sys
 
-from mic import msger
-from mic import pluginbase
-from mic.utils import errors
-from mic.utils.oe.misc import *
+from wic import msger
+from wic import pluginbase
+from wic.utils import errors
+from wic.utils.oe.misc import *
 
 __ALL__ = ['PluginMgr', 'pluginmgr']
 
 PLUGIN_TYPES = ["imager", "source"]
 
-PLUGIN_DIR = "/lib/mic/plugins" # relative to scripts
+PLUGIN_DIR = "/lib/wic/plugins" # relative to scripts
 SCRIPTS_PLUGIN_DIR = "scripts" + PLUGIN_DIR
 
 class PluginMgr(object):
@@ -41,9 +41,9 @@ class PluginMgr(object):
         return cls._instance
 
     def __init__(self):
-        mic_path = os.path.dirname(__file__)
-        eos = mic_path.find('scripts') + len('scripts')
-        scripts_path = mic_path[:eos]
+        wic_path = os.path.dirname(__file__)
+        eos = wic_path.find('scripts') + len('scripts')
+        scripts_path = wic_path[:eos]
         self.scripts_path = scripts_path
         self.plugin_dir = scripts_path + PLUGIN_DIR
         self.layers_path = None
diff --git a/scripts/lib/mic/pluginbase.py b/scripts/lib/wic/pluginbase.py
similarity index 88%
rename from scripts/lib/mic/pluginbase.py
rename to scripts/lib/wic/pluginbase.py
index 46a4f4a..06f318f 100644
--- a/scripts/lib/mic/pluginbase.py
+++ b/scripts/lib/wic/pluginbase.py
@@ -17,8 +17,8 @@
 
 import os
 import shutil
-from mic import msger
-from mic.utils import errors
+from wic import msger
+from wic.utils import errors
 
 class _Plugin(object):
     class __metaclass__(type):
@@ -26,15 +26,15 @@ class _Plugin(object):
             if not hasattr(cls, 'plugins'):
                 cls.plugins = {}
 
-            elif 'mic_plugin_type' in attrs:
-                if attrs['mic_plugin_type'] not in cls.plugins:
-                    cls.plugins[attrs['mic_plugin_type']] = {}
+            elif 'wic_plugin_type' in attrs:
+                if attrs['wic_plugin_type'] not in cls.plugins:
+                    cls.plugins[attrs['wic_plugin_type']] = {}
 
-            elif hasattr(cls, 'mic_plugin_type') and 'name' in attrs:
-                cls.plugins[cls.mic_plugin_type][attrs['name']] = cls
+            elif hasattr(cls, 'wic_plugin_type') and 'name' in attrs:
+                cls.plugins[cls.wic_plugin_type][attrs['name']] = cls
 
         def show_plugins(cls):
-            for cls in cls.plugins[cls.mic_plugin_type]:
+            for cls in cls.plugins[cls.wic_plugin_type]:
                 print cls
 
         def get_plugins(cls):
@@ -42,11 +42,11 @@ class _Plugin(object):
 
 
 class ImagerPlugin(_Plugin):
-    mic_plugin_type = "imager"
+    wic_plugin_type = "imager"
 
 
 class SourcePlugin(_Plugin):
-    mic_plugin_type = "source"
+    wic_plugin_type = "source"
     """
     The methods that can be implemented by --source plugins.
 
diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py
similarity index 89%
rename from scripts/lib/mic/plugins/imager/direct_plugin.py
rename to scripts/lib/wic/plugins/imager/direct_plugin.py
index c05a400..dabd6fc 100644
--- a/scripts/lib/mic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/wic/plugins/imager/direct_plugin.py
@@ -18,8 +18,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 # DESCRIPTION
-# This implements the 'direct' imager plugin class for 'wic', based
-# loosely on the raw imager plugin from 'mic'
+# This implements the 'direct' imager plugin class for 'wic'
 #
 # AUTHORS
 # Tom Zanussi <tom.zanussi (at] linux.intel.com>
@@ -30,13 +29,13 @@ import shutil
 import re
 import tempfile
 
-from mic import msger
-from mic.utils import misc, fs_related, errors, runner, cmdln
-from mic.conf import configmgr
-from mic.plugin import pluginmgr
+from wic import msger
+from wic.utils import misc, fs_related, errors, runner, cmdln
+from wic.conf import configmgr
+from wic.plugin import pluginmgr
 
-import mic.imager.direct as direct
-from mic.pluginbase import ImagerPlugin
+import wic.imager.direct as direct
+from wic.pluginbase import ImagerPlugin
 
 class DirectPlugin(ImagerPlugin):
     name = 'direct'
diff --git a/scripts/lib/mic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
similarity index 94%
rename from scripts/lib/mic/plugins/source/bootimg-efi.py
rename to scripts/lib/wic/plugins/source/bootimg-efi.py
index 5b1a533..53f1782 100644
--- a/scripts/lib/mic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -29,14 +29,14 @@ import shutil
 import re
 import tempfile
 
-from mic import kickstart, msger
-from mic.utils import misc, fs_related, errors, runner, cmdln
-from mic.conf import configmgr
-from mic.plugin import pluginmgr
-import mic.imager.direct as direct
-from mic.pluginbase import SourcePlugin
-from mic.utils.oe.misc import *
-from mic.imager.direct import DirectImageCreator
+from wic import kickstart, msger
+from wic.utils import misc, fs_related, errors, runner, cmdln
+from wic.conf import configmgr
+from wic.plugin import pluginmgr
+import wic.imager.direct as direct
+from wic.pluginbase import SourcePlugin
+from wic.utils.oe.misc import *
+from wic.imager.direct import DirectImageCreator
 
 class BootimgEFIPlugin(SourcePlugin):
     name = 'bootimg-efi'
diff --git a/scripts/lib/mic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
similarity index 95%
rename from scripts/lib/mic/plugins/source/bootimg-pcbios.py
rename to scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 959cf41..bd2225e 100644
--- a/scripts/lib/mic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -29,14 +29,14 @@ import shutil
 import re
 import tempfile
 
-from mic import kickstart, msger
-from mic.utils import misc, fs_related, errors, runner, cmdln
-from mic.conf import configmgr
-from mic.plugin import pluginmgr
-import mic.imager.direct as direct
-from mic.pluginbase import SourcePlugin
-from mic.utils.oe.misc import *
-from mic.imager.direct import DirectImageCreator
+from wic import kickstart, msger
+from wic.utils import misc, fs_related, errors, runner, cmdln
+from wic.conf import configmgr
+from wic.plugin import pluginmgr
+import wic.imager.direct as direct
+from wic.pluginbase import SourcePlugin
+from wic.utils.oe.misc import *
+from wic.imager.direct import DirectImageCreator
 
 class BootimgPcbiosPlugin(SourcePlugin):
     name = 'bootimg-pcbios'
diff --git a/scripts/lib/mic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
similarity index 90%
rename from scripts/lib/mic/plugins/source/rootfs.py
rename to scripts/lib/wic/plugins/source/rootfs.py
index 8ebf62c..919e97e 100644
--- a/scripts/lib/mic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -30,14 +30,14 @@ import shutil
 import re
 import tempfile
 
-from mic import kickstart, msger
-from mic.utils import misc, fs_related, errors, runner, cmdln
-from mic.conf import configmgr
-from mic.plugin import pluginmgr
-import mic.imager.direct as direct
-from mic.pluginbase import SourcePlugin
-from mic.utils.oe.misc import *
-from mic.imager.direct import DirectImageCreator
+from wic import kickstart, msger
+from wic.utils import misc, fs_related, errors, runner, cmdln
+from wic.conf import configmgr
+from wic.plugin import pluginmgr
+import wic.imager.direct as direct
+from wic.pluginbase import SourcePlugin
+from wic.utils.oe.misc import *
+from wic.imager.direct import DirectImageCreator
 
 class RootfsPlugin(SourcePlugin):
     name = 'rootfs'
diff --git a/scripts/lib/mic/test b/scripts/lib/wic/test
similarity index 100%
rename from scripts/lib/mic/test
rename to scripts/lib/wic/test
diff --git a/scripts/lib/mic/utils/__init__.py b/scripts/lib/wic/utils/__init__.py
similarity index 100%
rename from scripts/lib/mic/utils/__init__.py
rename to scripts/lib/wic/utils/__init__.py
diff --git a/scripts/lib/mic/utils/cmdln.py b/scripts/lib/wic/utils/cmdln.py
similarity index 100%
rename from scripts/lib/mic/utils/cmdln.py
rename to scripts/lib/wic/utils/cmdln.py
diff --git a/scripts/lib/mic/utils/errors.py b/scripts/lib/wic/utils/errors.py
similarity index 100%
rename from scripts/lib/mic/utils/errors.py
rename to scripts/lib/wic/utils/errors.py
diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/wic/utils/fs_related.py
similarity index 96%
rename from scripts/lib/mic/utils/fs_related.py
rename to scripts/lib/wic/utils/fs_related.py
index cf2a759..79cc1d5 100644
--- a/scripts/lib/mic/utils/fs_related.py
+++ b/scripts/lib/wic/utils/fs_related.py
@@ -26,10 +26,10 @@ import string
 import time
 import uuid
 
-from mic import msger
-from mic.utils import runner
-from mic.utils.errors import *
-from mic.utils.oe.misc import *
+from wic import msger
+from wic.utils import runner
+from wic.utils.errors import *
+from wic.utils.oe.misc import *
 
 def find_binary_path(binary):
     if os.environ.has_key("PATH"):
diff --git a/scripts/lib/mic/utils/misc.py b/scripts/lib/wic/utils/misc.py
similarity index 100%
rename from scripts/lib/mic/utils/misc.py
rename to scripts/lib/wic/utils/misc.py
diff --git a/scripts/lib/mic/utils/oe/__init__.py b/scripts/lib/wic/utils/oe/__init__.py
similarity index 95%
rename from scripts/lib/mic/utils/oe/__init__.py
rename to scripts/lib/wic/utils/oe/__init__.py
index d10e802..0a81575 100644
--- a/scripts/lib/mic/utils/oe/__init__.py
+++ b/scripts/lib/wic/utils/oe/__init__.py
@@ -1,5 +1,5 @@
 #
-# OpenEmbedded mic utils library
+# OpenEmbedded wic utils library
 #
 # Copyright (c) 2013, Intel Corporation.
 # All rights reserved.
diff --git a/scripts/lib/mic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
similarity index 97%
rename from scripts/lib/mic/utils/oe/misc.py
rename to scripts/lib/wic/utils/oe/misc.py
index bed2750..87e3041 100644
--- a/scripts/lib/mic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -18,15 +18,15 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 # DESCRIPTION
-# This module provides a place to collect various mic-related utils
+# This module provides a place to collect various wic-related utils
 # for the OpenEmbedded Image Tools.
 #
 # AUTHORS
 # Tom Zanussi <tom.zanussi (at] linux.intel.com>
 #
 
-from mic import msger
-from mic.utils import runner
+from wic import msger
+from wic.utils import runner
 
 def __exec_cmd(cmd_and_args, as_shell = False, catch = 3):
     """
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
similarity index 98%
rename from scripts/lib/mic/utils/partitionedfs.py
rename to scripts/lib/wic/utils/partitionedfs.py
index 68e4cab..76aa421 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -20,11 +20,11 @@
 
 import os
 
-from mic import msger
-from mic.utils import runner
-from mic.utils.errors import ImageError
-from mic.utils.fs_related import *
-from mic.utils.oe.misc import *
+from wic import msger
+from wic.utils import runner
+from wic.utils.errors import ImageError
+from wic.utils.fs_related import *
+from wic.utils.oe.misc import *
 
 # Overhead of the MBR partitioning scheme (just one sector)
 MBR_OVERHEAD = 1
diff --git a/scripts/lib/mic/utils/runner.py b/scripts/lib/wic/utils/runner.py
similarity index 99%
rename from scripts/lib/mic/utils/runner.py
rename to scripts/lib/wic/utils/runner.py
index fded3c9..e740dad 100644
--- a/scripts/lib/mic/utils/runner.py
+++ b/scripts/lib/wic/utils/runner.py
@@ -18,7 +18,7 @@
 import os
 import subprocess
 
-from mic import msger
+from wic import msger
 
 def runtool(cmdln_or_args, catch=1):
     """ wrapper for most of the subprocess calls
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 35/35] wic: Bump the version to 2.0
  2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
                   ` (33 preceding siblings ...)
  2014-08-08 22:05 ` [PATCH 34/35] wic: Rename /mic to /wic Tom Zanussi
@ 2014-08-08 22:06 ` Tom Zanussi
  34 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-08-08 22:06 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

This represents a complete rework, and if we assume the previous
version should have been 1.0 (instead of a silly .1x version), then
this should be 2.0.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/wic/__version__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/__version__.py b/scripts/lib/wic/__version__.py
index 60d7626..5452a46 100644
--- a/scripts/lib/wic/__version__.py
+++ b/scripts/lib/wic/__version__.py
@@ -1 +1 @@
-VERSION = "0.14"
+VERSION = "2.00"
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH 15/35] wic: Remove 3rdparty/urlgrabber
  2014-08-08 22:05 ` [PATCH 15/35] wic: Remove 3rdparty/urlgrabber Tom Zanussi
@ 2014-09-09 11:48   ` Ola X Nilsson
  2014-09-09 16:23     ` Tom Zanussi
  0 siblings, 1 reply; 38+ messages in thread
From: Ola X Nilsson @ 2014-09-09 11:48 UTC (permalink / raw)
  To: Tom Zanussi, openembedded-core

This commit breaks wic for me. 
Urlgrabber is imported from pykickstart/version.py and pykickstart/parser.py.

Having python-urlgrabber installed in your distro hides this problem.

-- 
Ola Nilsson

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf
> Of Tom Zanussi
> Sent: den 9 augusti 2014 00:06
> To: openembedded-core@lists.openembedded.org
> Cc: Tom Zanussi
> Subject: [OE-core] [PATCH 15/35] wic: Remove 3rdparty/urlgrabber
> 
> wic doesn't use it, so remove it.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  .../3rdparty/pykickstart/urlgrabber/__init__.py    |   53 -
>  .../3rdparty/pykickstart/urlgrabber/byterange.py   |  463 ------
>  .../mic/3rdparty/pykickstart/urlgrabber/grabber.py | 1477 --------------------
>  .../3rdparty/pykickstart/urlgrabber/keepalive.py   |  617 --------
>  .../mic/3rdparty/pykickstart/urlgrabber/mirror.py  |  458 ------
>  .../3rdparty/pykickstart/urlgrabber/progress.py    |  530 -------
>  .../3rdparty/pykickstart/urlgrabber/sslfactory.py  |   90 --
>  7 files changed, 3688 deletions(-)
>  delete mode 100644
> scripts/lib/mic/3rdparty/pykickstart/urlgrabber/__init__.py
>  delete mode 100644
> scripts/lib/mic/3rdparty/pykickstart/urlgrabber/byterange.py
>  delete mode 100644
> scripts/lib/mic/3rdparty/pykickstart/urlgrabber/grabber.py
>  delete mode 100644
> scripts/lib/mic/3rdparty/pykickstart/urlgrabber/keepalive.py
>  delete mode 100644
> scripts/lib/mic/3rdparty/pykickstart/urlgrabber/mirror.py
>  delete mode 100644
> scripts/lib/mic/3rdparty/pykickstart/urlgrabber/progress.py
>  delete mode 100644
> scripts/lib/mic/3rdparty/pykickstart/urlgrabber/sslfactory.py
> 
> Patch too large to post - see git repository.
> 
> --
> 1.8.3.1
> 
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 15/35] wic: Remove 3rdparty/urlgrabber
  2014-09-09 11:48   ` Ola X Nilsson
@ 2014-09-09 16:23     ` Tom Zanussi
  0 siblings, 0 replies; 38+ messages in thread
From: Tom Zanussi @ 2014-09-09 16:23 UTC (permalink / raw)
  To: Ola X Nilsson; +Cc: openembedded-core

On Tue, 2014-09-09 at 13:48 +0200, Ola X Nilsson wrote:
> This commit breaks wic for me. 
> Urlgrabber is imported from pykickstart/version.py and pykickstart/parser.py.
> 
> Having python-urlgrabber installed in your distro hides this problem.
> 

Thanks for the report - I just posted a patch to fix this to the list -
please try it out.

Thanks,

Tom



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2014-09-09 16:23 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-08 22:05 [PATCH 00/35] wic: diet and refactor Tom Zanussi
2014-08-08 22:05 ` [PATCH 01/35] wic: Make exec_cmd() error out instead of warn Tom Zanussi
2014-08-08 22:05 ` [PATCH 02/35] wic: Remove unused custom commands Tom Zanussi
2014-08-08 22:05 ` [PATCH 03/35] wic: Remove packaging, config commands Tom Zanussi
2014-08-08 22:05 ` [PATCH 04/35] wic: Remove mic bootstrap Tom Zanussi
2014-08-08 22:05 ` [PATCH 05/35] wic: Remove mic chroot Tom Zanussi
2014-08-08 22:05 ` [PATCH 06/35] wic: Remove rt_util Tom Zanussi
2014-08-08 22:05 ` [PATCH 07/35] wic: Remove mic package managers Tom Zanussi
2014-08-08 22:05 ` [PATCH 08/35] wic: Remove bmap support Tom Zanussi
2014-08-08 22:05 ` [PATCH 09/35] wic: Remove fiemap support Tom Zanussi
2014-08-08 22:05 ` [PATCH 10/35] wic: Remove grabber implementation Tom Zanussi
2014-08-08 22:05 ` [PATCH 11/35] wic: Remove proxy support Tom Zanussi
2014-08-08 22:05 ` [PATCH 12/35] wic: Remove rpmmisc Tom Zanussi
2014-08-08 22:05 ` [PATCH 13/35] wic: Remove unused fs_related code Tom Zanussi
2014-08-08 22:05 ` [PATCH 14/35] wic: Remove unused misc code Tom Zanussi
2014-08-08 22:05 ` [PATCH 15/35] wic: Remove 3rdparty/urlgrabber Tom Zanussi
2014-09-09 11:48   ` Ola X Nilsson
2014-09-09 16:23     ` Tom Zanussi
2014-08-08 22:05 ` [PATCH 16/35] wic: Remove unused 3rdparty/commands Tom Zanussi
2014-08-08 22:05 ` [PATCH 17/35] wic: Remove gpt_parser Tom Zanussi
2014-08-08 22:05 ` [PATCH 18/35] wic: Remove unused plugin and error code Tom Zanussi
2014-08-08 22:05 ` [PATCH 19/35] wic: Clean up BaseImageCreator Tom Zanussi
2014-08-08 22:05 ` [PATCH 20/35] wic: Clean up DirectImageCreator Tom Zanussi
2014-08-08 22:05 ` [PATCH 21/35] wic: Clean up PartitionedMount Tom Zanussi
2014-08-08 22:05 ` [PATCH 22/35] wic: Clean up Creator Tom Zanussi
2014-08-08 22:05 ` [PATCH 23/35] wic: Remove unused command versioning support Tom Zanussi
2014-08-08 22:05 ` [PATCH 24/35] wic: Update 'Background and Motivation' help section Tom Zanussi
2014-08-08 22:05 ` [PATCH 25/35] wic: Remove unused conf support Tom Zanussi
2014-08-08 22:05 ` [PATCH 26/35] wic: Remove Mount object Tom Zanussi
2014-08-08 22:05 ` [PATCH 27/35] wic: Update/rename/delete mount-related code Tom Zanussi
2014-08-08 22:05 ` [PATCH 28/35] wic: Update cleanup/unmount-related code Tom Zanussi
2014-08-08 22:05 ` [PATCH 29/35] wic: Update/rename install-related code Tom Zanussi
2014-08-08 22:05 ` [PATCH 30/35] wic: Update/rename configure-related code Tom Zanussi
2014-08-08 22:05 ` [PATCH 31/35] wic: Rename PartitionedMount Tom Zanussi
2014-08-08 22:05 ` [PATCH 32/35] wic: Rename MountError Tom Zanussi
2014-08-08 22:05 ` [PATCH 33/35] wic: Update Disk description Tom Zanussi
2014-08-08 22:05 ` [PATCH 34/35] wic: Rename /mic to /wic Tom Zanussi
2014-08-08 22:06 ` [PATCH 35/35] wic: Bump the version to 2.0 Tom Zanussi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.