summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2013-08-24 15:31:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-01 22:56:03 +0100
commit9fc88f96d40b17c90bac53b90045a87b2d2cff84 (patch)
tree63010e5aabf895697655baf89bd668d6752b3f97 /scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py
parent53a1d9a788fd9f970af980da2ab975cca60685c4 (diff)
downloadpoky-9fc88f96d40b17c90bac53b90045a87b2d2cff84.tar.gz
wic: Add mic w/pykickstart
This is the starting point for the implemention described in [YOCTO 3847] which came to the conclusion that it would make sense to use kickstart syntax to implement image creation in OpenEmbedded. I subsequently realized that there was an existing tool that already implemented image creation using kickstart syntax, the Tizen/Meego mic tool. As such, it made sense to use that as a starting point - this commit essentially just copies the relevant Python code from the MIC tool to the scripts/lib dir, where it can be accessed by the previously created wic tool. Most of this will be removed or renamed by later commits, since we're initially focusing on partitioning only. Care should be taken so that we can easily add back any additional functionality should we decide later to expand the tool, though (we may also want to contribute our local changes to the mic tool to the Tizen project if it makes sense, and therefore should avoid gratuitous changes to the original code if possible). Added the /mic subdir from Tizen mic repo as a starting point: git clone git://review.tizen.org/tools/mic.git For reference, the top commit: commit 20164175ddc234a17b8a12c33d04b012347b1530 Author: Gui Chen <gui.chen@intel.com> Date: Sun Jun 30 22:32:16 2013 -0400 bump up to 0.19.2 Also added the /plugins subdir, moved to under the /mic subdir (to match the default plugin_dir location in mic.conf.in, which was renamed to yocto-image.conf (moved and renamed by later patches) and put into /scripts. (From OE-Core rev: 31f0360f1fd4ebc9dfcaed42d1c50d2448b4632e) 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/3rdparty/pykickstart/commands/xconfig.py')
-rw-r--r--scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py184
1 files changed, 184 insertions, 0 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py b/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py
new file mode 100644
index 0000000000..644ee86743
--- /dev/null
+++ b/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py
@@ -0,0 +1,184 @@
1#
2# Chris Lumens <clumens@redhat.com>
3#
4# Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
5#
6# This copyrighted material is made available to anyone wishing to use, modify,
7# copy, or redistribute it subject to the terms and conditions of the GNU
8# General Public License v.2. This program is distributed in the hope that it
9# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
10# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11# See the GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along with
14# this program; if not, write to the Free Software Foundation, Inc., 51
15# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat
16# trademarks that are incorporated in the source code or documentation are not
17# subject to the GNU General Public License and may only be used or replicated
18# with the express permission of Red Hat, Inc.
19#
20from pykickstart.base import *
21from pykickstart.errors import *
22from pykickstart.options import *
23
24import gettext
25_ = lambda x: gettext.ldgettext("pykickstart", x)
26
27class FC3_XConfig(KickstartCommand):
28 removedKeywords = KickstartCommand.removedKeywords
29 removedAttrs = KickstartCommand.removedAttrs
30
31 def __init__(self, writePriority=0, *args, **kwargs):
32 KickstartCommand.__init__(self, writePriority, *args, **kwargs)
33 self.op = self._getParser()
34
35 self.card = kwargs.get("card", "")
36 self.defaultdesktop = kwargs.get("defaultdesktop", "")
37 self.depth = kwargs.get("depth", 0)
38 self.hsync = kwargs.get("hsync", "")
39 self.monitor = kwargs.get("monitor", "")
40 self.noProbe = kwargs.get("noProbe", False)
41 self.resolution = kwargs.get("resolution", "")
42 self.server = kwargs.get("server", "")
43 self.startX = kwargs.get("startX", False)
44 self.videoRam = kwargs.get("videoRam", "")
45 self.vsync = kwargs.get("vsync", "")
46
47 def __str__(self):
48 retval = KickstartCommand.__str__(self)
49
50 if self.card != "":
51 retval += " --card=%s" % self.card
52 if self.defaultdesktop != "":
53 retval += " --defaultdesktop=%s" % self.defaultdesktop
54 if self.depth != 0:
55 retval += " --depth=%d" % self.depth
56 if self.hsync != "":
57 retval += " --hsync=%s" % self.hsync
58 if self.monitor != "":
59 retval += " --monitor=%s" % self.monitor
60 if self.noProbe:
61 retval += " --noprobe"
62 if self.resolution != "":
63 retval += " --resolution=%s" % self.resolution
64 if self.server != "":
65 retval += " --server=%s" % self.server
66 if self.startX:
67 retval += " --startxonboot"
68 if self.videoRam != "":
69 retval += " --videoram=%s" % self.videoRam
70 if self.vsync != "":
71 retval += " --vsync=%s" % self.vsync
72
73 if retval != "":
74 retval = "# X Window System configuration information\nxconfig %s\n" % retval
75
76 return retval
77
78 def _getParser(self):
79 op = KSOptionParser()
80 op.add_option("--card")
81 op.add_option("--defaultdesktop")
82 op.add_option("--depth", action="store", type="int", nargs=1)
83 op.add_option("--hsync")
84 op.add_option("--monitor")
85 op.add_option("--noprobe", dest="noProbe", action="store_true",
86 default=False)
87 op.add_option("--resolution")
88 op.add_option("--server")
89 op.add_option("--startxonboot", dest="startX", action="store_true",
90 default=False)
91 op.add_option("--videoram", dest="videoRam")
92 op.add_option("--vsync")
93 return op
94
95 def parse(self, args):
96 (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
97 if extra:
98 mapping = {"command": "xconfig", "options": extra}
99 raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping)
100
101 self._setToSelf(self.op, opts)
102 return self
103
104class FC6_XConfig(FC3_XConfig):
105 removedKeywords = FC3_XConfig.removedKeywords + ["card", "hsync", "monitor", "noProbe", "vsync"]
106 removedAttrs = FC3_XConfig.removedAttrs + ["card", "hsync", "monitor", "noProbe", "vsync"]
107
108 def __init__(self, writePriority=0, *args, **kwargs):
109 FC3_XConfig.__init__(self, writePriority, *args, **kwargs)
110 self.deleteRemovedAttrs()
111
112 self.driver = kwargs.get("driver", "")
113
114 def __str__(self):
115 retval = KickstartCommand.__str__(self)
116
117 if hasattr(self, "driver") and self.driver != "":
118 retval += " --driver=%s" % self.driver
119 if self.defaultdesktop != "":
120 retval += " --defaultdesktop=%s" % self.defaultdesktop
121 if self.depth != 0:
122 retval += " --depth=%d" % self.depth
123 if hasattr(self, "resolution") and self.resolution != "":
124 retval += " --resolution=%s" % self.resolution
125 if self.startX:
126 retval += " --startxonboot"
127 if hasattr(self, "videoRam") and self.videoRam != "":
128 retval += " --videoram=%s" % self.videoRam
129
130 if retval != "":
131 retval = "# X Window System configuration information\nxconfig %s\n" % retval
132
133 return retval
134
135 def _getParser(self):
136 op = FC3_XConfig._getParser(self)
137 op.add_option("--card", deprecated=1)
138 op.add_option("--driver", dest="driver")
139 op.add_option("--hsync", deprecated=1)
140 op.add_option("--monitor", deprecated=1)
141 op.add_option("--noprobe", deprecated=1)
142 op.add_option("--vsync", deprecated=1)
143 return op
144
145class F9_XConfig(FC6_XConfig):
146 removedKeywords = FC6_XConfig.removedKeywords
147 removedAttrs = FC6_XConfig.removedAttrs
148
149 def _getParser(self):
150 op = FC6_XConfig._getParser(self)
151 op.remove_option("--card")
152 op.remove_option("--hsync")
153 op.remove_option("--monitor")
154 op.remove_option("--noprobe")
155 op.remove_option("--vsync")
156 return op
157
158class F10_XConfig(F9_XConfig):
159 removedKeywords = F9_XConfig.removedKeywords + ["driver", "resolution", "videoRam"]
160 removedAttrs = F9_XConfig.removedAttrs + ["driver", "resolution", "videoRam"]
161
162 def __init__(self, writePriority=0, *args, **kwargs):
163 F9_XConfig.__init__(self, writePriority, *args, **kwargs)
164 self.deleteRemovedAttrs()
165
166 def _getParser(self):
167 op = F9_XConfig._getParser(self)
168 op.add_option("--driver", deprecated=1)
169 op.add_option("--depth", deprecated=1)
170 op.add_option("--resolution", deprecated=1)
171 op.add_option("--videoram", deprecated=1)
172 return op
173
174class F14_XConfig(F10_XConfig):
175 removedKeywords = F10_XConfig.removedKeywords
176 removedAttrs = F10_XConfig.removedAttrs
177
178 def _getParser(self):
179 op = F10_XConfig._getParser(self)
180 op.remove_option("--driver")
181 op.remove_option("--depth")
182 op.remove_option("--resolution")
183 op.remove_option("--videoram")
184 return op