diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/image/config/wic.conf | 1 | ||||
-rw-r--r-- | scripts/lib/mic/conf.py | 39 | ||||
-rw-r--r-- | scripts/lib/mic/imager/baseimager.py | 13 | ||||
-rw-r--r-- | scripts/lib/mic/imager/direct.py | 6 | ||||
-rw-r--r-- | scripts/lib/mic/plugins/imager/direct_plugin.py | 4 | ||||
-rw-r--r-- | 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 e96d6aec45..a51bcb55eb 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 1fe6edd724..a686e9caa7 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 55f2deaf2c..0d591eaf43 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 92473b5bb7..2e6914b86d 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 877aaf6105..793a736e95 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 010b16ca49..194b88f691 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 |