summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2014-08-07 12:04:06 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-11 10:53:11 +0100
commitd74e7d3fa693eb7037a57dfbd0c47bc53255316f (patch)
tree21a01a1f82c164f27391c807df716d1ed21d39f1 /scripts
parent554feeebe07cd47c58a960e6d8193f085427d53a (diff)
downloadpoky-d74e7d3fa693eb7037a57dfbd0c47bc53255316f.tar.gz
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/image/config/wic.conf1
-rw-r--r--scripts/lib/mic/conf.py39
-rw-r--r--scripts/lib/mic/imager/baseimager.py13
-rw-r--r--scripts/lib/mic/imager/direct.py6
-rw-r--r--scripts/lib/mic/plugins/imager/direct_plugin.py4
-rw-r--r--scripts/lib/mic/utils/misc.py48
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
4 4
5[create] 5[create]
6; settings for create subcommand 6; settings for create subcommand
7runtime=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():
31 return scripts_path + "/lib/image/config/wic.conf" 31 return scripts_path + "/lib/image/config/wic.conf"
32 32
33class ConfigMgr(object): 33class ConfigMgr(object):
34 prefer_backends = ["zypp", "yum"]
35
36 DEFAULTS = {'common': { 34 DEFAULTS = {'common': {
37 "distro_name": "Default Distribution", 35 "distro_name": "Default Distribution",
38 "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also? 36 "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also?
39 }, 37 },
40 'create': { 38 'create': {
41 "tmpdir": '/var/tmp/wic', 39 "tmpdir": '/var/tmp/wic',
42 "cachedir": '/var/tmp/wic/cache',
43 "outdir": './wic-output', 40 "outdir": './wic-output',
44 41
45 "arch": None, # None means auto-detect
46 "pkgmgr": "auto",
47 "name": "output",
48 "ksfile": None,
49 "ks": None,
50 "repomd": None,
51 "local_pkgs_path": None,
52 "release": None, 42 "release": None,
53 "logfile": None, 43 "logfile": None,
54 "record_pkgs": [],
55 "pack_to": None,
56 "name_prefix": None, 44 "name_prefix": None,
57 "name_suffix": None, 45 "name_suffix": None,
58 "copy_kernel": False,
59 "install_pkgs": None,
60 "repourl": {},
61 "localrepos": [], # save localrepos
62 "runtime": "bootstrap",
63 },
64 'chroot': {
65 "saveto": None,
66 },
67 'convert': {
68 "shell": False,
69 },
70 'bootstrap': {
71 "rootdir": '/var/tmp/wic-bootstrap',
72 "packages": [],
73 }, 46 },
74 } 47 }
75 48
@@ -116,10 +89,6 @@ class ConfigMgr(object):
116 if not ksconf: 89 if not ksconf:
117 return 90 return
118 91
119 ksconf = misc.normalize_ksfile(ksconf,
120 self.create['release'],
121 self.create['arch'])
122
123 ks = kickstart.read_kickstart(ksconf) 92 ks = kickstart.read_kickstart(ksconf)
124 93
125 self.create['ks'] = ks 94 self.create['ks'] = ks
@@ -130,12 +99,4 @@ class ConfigMgr(object):
130 self.create['name_prefix'], 99 self.create['name_prefix'],
131 self.create['name_suffix']) 100 self.create['name_suffix'])
132 101
133 def set_runtime(self, runtime):
134 if runtime not in ("bootstrap", "native"):
135 msger.error("Invalid runtime mode: %s" % runtime)
136
137 if misc.get_distro()[0] in ("tizen", "Tizen"):
138 runtime = "native"
139 self.create['runtime'] = runtime
140
141configmgr = ConfigMgr() 102configmgr = 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):
176 176
177 runner.show('umount -l %s' % self.workdir) 177 runner.show('umount -l %s' % self.workdir)
178 178
179 def mount(self, base_on = None, cachedir = None): 179 def mount(self):
180 """Setup the target filesystem in preparation for an install. 180 """Setup the target filesystem in preparation for an install.
181 181
182 This function sets up the filesystem which the ImageCreator will 182 This function sets up the filesystem which the ImageCreator will
@@ -184,20 +184,11 @@ class BaseImageCreator(object):
184 install root directory, bind mounts some system directories (e.g. /dev) 184 install root directory, bind mounts some system directories (e.g. /dev)
185 and writes out /etc/fstab. Other subclasses may also e.g. create a 185 and writes out /etc/fstab. Other subclasses may also e.g. create a
186 sparse file, format it and loopback mount it to the install root. 186 sparse file, format it and loopback mount it to the install root.
187
188 base_on -- a previous install on which to base this install; defaults
189 to None, causing a new image to be created
190
191 cachedir -- a directory in which to store the Yum cache; defaults to
192 None, causing a new cache to be created; by setting this
193 to another directory, the same cache can be reused across
194 multiple installs.
195
196 """ 187 """
197 self.__setup_tmpdir() 188 self.__setup_tmpdir()
198 self.__ensure_builddir() 189 self.__ensure_builddir()
199 190
200 self._mount_instroot(base_on) 191 self._mount_instroot()
201 192
202 def unmount(self): 193 def unmount(self):
203 """Unmounts the target filesystem. 194 """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):
217 # 217 #
218 # Actual implemention 218 # Actual implemention
219 # 219 #
220 def _mount_instroot(self, base_on = None): 220 def _mount_instroot(self):
221 """ 221 """
222 For 'wic', we already have our build artifacts and don't want 222 For 'wic', we already have our build artifacts and don't want
223 to loop mount anything to install into, we just create 223 to loop mount anything to install into, we just create
@@ -296,7 +296,7 @@ class DirectImageCreator(BaseImageCreator):
296 296
297 self.__instimage.mount() 297 self.__instimage.mount()
298 298
299 def install(self, repo_urls=None): 299 def install(self):
300 """ 300 """
301 Install fs images into partitions 301 Install fs images into partitions
302 """ 302 """
@@ -306,7 +306,7 @@ class DirectImageCreator(BaseImageCreator):
306 % (disk_name, full_path, disk['min_size'])) 306 % (disk_name, full_path, disk['min_size']))
307 self.__instimage.install(full_path) 307 self.__instimage.install(full_path)
308 308
309 def configure(self, repodata = None): 309 def configure(self):
310 """ 310 """
311 Configure the system image according to kickstart. 311 Configure the system image according to kickstart.
312 312
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):
91 creatoropts) 91 creatoropts)
92 92
93 try: 93 try:
94 creator.mount(None, creatoropts["cachedir"]) 94 creator.mount()
95 creator.install() 95 creator.install()
96 creator.configure(creatoropts["repomd"]) 96 creator.configure()
97 creator.print_outimage_info() 97 creator.print_outimage_info()
98 98
99 except errors.CreatorError: 99 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
19import sys 19import sys
20import time 20import time
21 21
22from mic import msger
23from mic.utils.errors import CreatorError
24from mic.utils.fs_related import find_binary_path, makedirs
25from mic.utils import runner
26
27def build_name(kscfg, release=None, prefix = None, suffix = None): 22def build_name(kscfg, release=None, prefix = None, suffix = None):
28 """Construct and return an image name string. 23 """Construct and return an image name string.
29 24
@@ -60,46 +55,5 @@ def build_name(kscfg, release=None, prefix = None, suffix = None):
60 suffix = "-%s" % suffix if suffix else "" 55 suffix = "-%s" % suffix if suffix else ""
61 56
62 ret = prefix + name + suffix 57 ret = prefix + name + suffix
63 return ret
64
65def normalize_ksfile(ksconf, release, arch):
66 '''
67 Return the name of a normalized ks file in which macro variables
68 @BUILD_ID@ and @ARCH@ are replace with real values.
69
70 The original ks file is returned if no special macro is used, otherwise
71 a temp file is created and returned, which will be deleted when program
72 exits normally.
73 '''
74
75 if not release:
76 release = "latest"
77 if not arch or re.match(r'i.86', arch):
78 arch = "ia32"
79
80 with open(ksconf) as f:
81 ksc = f.read()
82
83 if "@ARCH@" not in ksc and "@BUILD_ID@" not in ksc:
84 return ksconf
85 58
86 msger.info("Substitute macro variable @BUILD_ID@/@ARCH@ in ks: %s" % ksconf) 59 return ret
87 ksc = ksc.replace("@ARCH@", arch)
88 ksc = ksc.replace("@BUILD_ID@", release)
89
90 fd, ksconf = tempfile.mkstemp(prefix=os.path.basename(ksconf))
91 os.write(fd, ksc)
92 os.close(fd)
93
94 msger.debug('normalized ks file:%s' % ksconf)
95
96 def remove_temp_ks():
97 try:
98 os.unlink(ksconf)
99 except OSError, err:
100 msger.warning('Failed to remove temp ks file:%s:%s' % (ksconf, err))
101
102 import atexit
103 atexit.register(remove_temp_ks)
104
105 return ksconf