mirror of
https://git.yoctoproject.org/poky
synced 2026-06-04 14:09:47 +00:00
wic: Remove unused conf support
Also fix up users such as imager functions. (From OE-Core rev: eb77b9c11bd9b8dc90aacfbd5b5bc5568a233525) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
554feeebe0
commit
d74e7d3fa6
@@ -4,4 +4,3 @@ distro_name = OpenEmbedded
|
|||||||
|
|
||||||
[create]
|
[create]
|
||||||
; settings for create subcommand
|
; settings for create subcommand
|
||||||
runtime=native
|
|
||||||
|
|||||||
@@ -31,45 +31,18 @@ def get_siteconf():
|
|||||||
return scripts_path + "/lib/image/config/wic.conf"
|
return scripts_path + "/lib/image/config/wic.conf"
|
||||||
|
|
||||||
class ConfigMgr(object):
|
class ConfigMgr(object):
|
||||||
prefer_backends = ["zypp", "yum"]
|
|
||||||
|
|
||||||
DEFAULTS = {'common': {
|
DEFAULTS = {'common': {
|
||||||
"distro_name": "Default Distribution",
|
"distro_name": "Default Distribution",
|
||||||
"plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also?
|
"plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also?
|
||||||
},
|
},
|
||||||
'create': {
|
'create': {
|
||||||
"tmpdir": '/var/tmp/wic',
|
"tmpdir": '/var/tmp/wic',
|
||||||
"cachedir": '/var/tmp/wic/cache',
|
|
||||||
"outdir": './wic-output',
|
"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,
|
"release": None,
|
||||||
"logfile": None,
|
"logfile": None,
|
||||||
"record_pkgs": [],
|
|
||||||
"pack_to": None,
|
|
||||||
"name_prefix": None,
|
"name_prefix": None,
|
||||||
"name_suffix": 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:
|
if not ksconf:
|
||||||
return
|
return
|
||||||
|
|
||||||
ksconf = misc.normalize_ksfile(ksconf,
|
|
||||||
self.create['release'],
|
|
||||||
self.create['arch'])
|
|
||||||
|
|
||||||
ks = kickstart.read_kickstart(ksconf)
|
ks = kickstart.read_kickstart(ksconf)
|
||||||
|
|
||||||
self.create['ks'] = ks
|
self.create['ks'] = ks
|
||||||
@@ -130,12 +99,4 @@ class ConfigMgr(object):
|
|||||||
self.create['name_prefix'],
|
self.create['name_prefix'],
|
||||||
self.create['name_suffix'])
|
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()
|
configmgr = ConfigMgr()
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class BaseImageCreator(object):
|
|||||||
|
|
||||||
runner.show('umount -l %s' % self.workdir)
|
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.
|
"""Setup the target filesystem in preparation for an install.
|
||||||
|
|
||||||
This function sets up the filesystem which the ImageCreator will
|
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)
|
install root directory, bind mounts some system directories (e.g. /dev)
|
||||||
and writes out /etc/fstab. Other subclasses may also e.g. create a
|
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.
|
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.__setup_tmpdir()
|
||||||
self.__ensure_builddir()
|
self.__ensure_builddir()
|
||||||
|
|
||||||
self._mount_instroot(base_on)
|
self._mount_instroot()
|
||||||
|
|
||||||
def unmount(self):
|
def unmount(self):
|
||||||
"""Unmounts the target filesystem.
|
"""Unmounts the target filesystem.
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||||||
#
|
#
|
||||||
# Actual implemention
|
# 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
|
For 'wic', we already have our build artifacts and don't want
|
||||||
to loop mount anything to install into, we just create
|
to loop mount anything to install into, we just create
|
||||||
@@ -296,7 +296,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||||||
|
|
||||||
self.__instimage.mount()
|
self.__instimage.mount()
|
||||||
|
|
||||||
def install(self, repo_urls=None):
|
def install(self):
|
||||||
"""
|
"""
|
||||||
Install fs images into partitions
|
Install fs images into partitions
|
||||||
"""
|
"""
|
||||||
@@ -306,7 +306,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||||||
% (disk_name, full_path, disk['min_size']))
|
% (disk_name, full_path, disk['min_size']))
|
||||||
self.__instimage.install(full_path)
|
self.__instimage.install(full_path)
|
||||||
|
|
||||||
def configure(self, repodata = None):
|
def configure(self):
|
||||||
"""
|
"""
|
||||||
Configure the system image according to kickstart.
|
Configure the system image according to kickstart.
|
||||||
|
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ class DirectPlugin(ImagerPlugin):
|
|||||||
creatoropts)
|
creatoropts)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
creator.mount(None, creatoropts["cachedir"])
|
creator.mount()
|
||||||
creator.install()
|
creator.install()
|
||||||
creator.configure(creatoropts["repomd"])
|
creator.configure()
|
||||||
creator.print_outimage_info()
|
creator.print_outimage_info()
|
||||||
|
|
||||||
except errors.CreatorError:
|
except errors.CreatorError:
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
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):
|
def build_name(kscfg, release=None, prefix = None, suffix = None):
|
||||||
"""Construct and return an image name string.
|
"""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 ""
|
suffix = "-%s" % suffix if suffix else ""
|
||||||
|
|
||||||
ret = prefix + name + suffix
|
ret = prefix + name + suffix
|
||||||
|
|
||||||
return ret
|
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user