summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/conf.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2013-09-19 04:32:19 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-01 22:56:03 +0100
commit75c143a7aef46ecea07cf33edd2b1a0192e10149 (patch)
treefe0eb61a0dfda72e52b01385129f6282814581b6 /scripts/lib/mic/conf.py
parent9fc88f96d40b17c90bac53b90045a87b2d2cff84 (diff)
downloadpoky-75c143a7aef46ecea07cf33edd2b1a0192e10149.tar.gz
wic: Add OpenEmbedded-specific implementation
Reuses the mic/livecd infrastructure but heavily subclasses and modifies it to adapt to the special needs of building images from existing OpenEmbedded build artifacts. In addition to the OE-specific mic objects and modifications to the underlying infrastructure, this adds a mechanism to allow OE kickstart files to be 'canned' and made available to users via the 'wic list images' command. Two initial OE kickstart files have been added as canned .wks files: directdisk, which implements the same thing as the images created by directdisk.bbclass, and mkefidisk, which can essentially be used as a replacement for mkefidisk.sh. Of course, since creation of these images are now driven by .wks files rather than being hard-coded into class files or scripts, they can be easily modified to generate different variations on those images. They also don't require root priveleges, since they don't use mount to create the images. They don't however write to media like mkefidisk.sh does, but rather create images that can be written onto media. (From OE-Core rev: f87acc5e59d3c2c39ff171b5557977dab4c8f4a6) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/mic/conf.py')
-rw-r--r--scripts/lib/mic/conf.py54
1 files changed, 8 insertions, 46 deletions
diff --git a/scripts/lib/mic/conf.py b/scripts/lib/mic/conf.py
index e37334cc7a..58fad51f89 100644
--- a/scripts/lib/mic/conf.py
+++ b/scripts/lib/mic/conf.py
@@ -23,29 +23,24 @@ from mic import kickstart
23from mic.utils import misc, runner, proxy, errors 23from mic.utils import misc, runner, proxy, errors
24 24
25 25
26DEFAULT_GSITECONF = '/etc/mic/mic.conf'
27
28
29def get_siteconf(): 26def get_siteconf():
30 mic_path = os.path.dirname(__file__) 27 mic_path = os.path.dirname(__file__)
28 eos = mic_path.find('scripts') + len('scripts')
29 scripts_path = mic_path[:eos]
31 30
32 m = re.match(r"(?P<prefix>.*)\/lib(64)?\/.*", mic_path) 31 return scripts_path + "/lib/image/config/wic.conf"
33 if m and m.group('prefix') != "/usr":
34 return os.path.join(m.group('prefix'), "etc/mic/mic.conf")
35
36 return DEFAULT_GSITECONF
37 32
38class ConfigMgr(object): 33class ConfigMgr(object):
39 prefer_backends = ["zypp", "yum"] 34 prefer_backends = ["zypp", "yum"]
40 35
41 DEFAULTS = {'common': { 36 DEFAULTS = {'common': {
42 "distro_name": "Default Distribution", 37 "distro_name": "Default Distribution",
43 "plugin_dir": "/usr/lib/mic/plugins", # TODO use prefix also? 38 "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also?
44 }, 39 },
45 'create': { 40 'create': {
46 "tmpdir": '/var/tmp/mic', 41 "tmpdir": '/var/tmp/wic',
47 "cachedir": '/var/tmp/mic/cache', 42 "cachedir": '/var/tmp/wic/cache',
48 "outdir": './mic-output', 43 "outdir": './wic-output',
49 44
50 "arch": None, # None means auto-detect 45 "arch": None, # None means auto-detect
51 "pkgmgr": "auto", 46 "pkgmgr": "auto",
@@ -75,7 +70,7 @@ class ConfigMgr(object):
75 "shell": False, 70 "shell": False,
76 }, 71 },
77 'bootstrap': { 72 'bootstrap': {
78 "rootdir": '/var/tmp/mic-bootstrap', 73 "rootdir": '/var/tmp/wic-bootstrap',
79 "packages": [], 74 "packages": [],
80 }, 75 },
81 } 76 }
@@ -191,39 +186,6 @@ class ConfigMgr(object):
191 self.create['name_prefix'], 186 self.create['name_prefix'],
192 self.create['name_suffix']) 187 self.create['name_suffix'])
193 188
194 msger.info("Retrieving repo metadata:")
195 ksrepos = misc.get_repostrs_from_ks(ks)
196 if not ksrepos:
197 raise errors.KsError('no valid repos found in ks file')
198
199 for repo in ksrepos:
200 if 'baseurl' in repo and repo['baseurl'].startswith("file:"):
201 repourl = repo['baseurl'].replace('file:', '')
202 repourl = "/%s" % repourl.lstrip('/')
203 self.create['localrepos'].append(repourl)
204
205 self.create['repomd'] = misc.get_metadata_from_repos(
206 ksrepos,
207 self.create['cachedir'])
208 msger.raw(" DONE")
209
210 target_archlist, archlist = misc.get_arch(self.create['repomd'])
211 if self.create['arch']:
212 if self.create['arch'] not in archlist:
213 raise errors.ConfigError("Invalid arch %s for repository. "
214 "Valid arches: %s" \
215 % (self.create['arch'], ', '.join(archlist)))
216 else:
217 if len(target_archlist) == 1:
218 self.create['arch'] = str(target_archlist[0])
219 msger.info("\nUse detected arch %s." % target_archlist[0])
220 else:
221 raise errors.ConfigError("Please specify a valid arch, "
222 "the choice can be: %s" \
223 % ', '.join(archlist))
224
225 kickstart.resolve_groups(self.create, self.create['repomd'])
226
227 # check selinux, it will block arm and btrfs image creation 189 # check selinux, it will block arm and btrfs image creation
228 misc.selinux_check(self.create['arch'], 190 misc.selinux_check(self.create['arch'],
229 [p.fstype for p in ks.handler.partition.partitions]) 191 [p.fstype for p in ks.handler.partition.partitions])