summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/3rdparty/pykickstart/commands/vnc.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/vnc.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/vnc.py')
-rw-r--r--scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py114
1 files changed, 114 insertions, 0 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py b/scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py
new file mode 100644
index 0000000000..200ccfba2e
--- /dev/null
+++ b/scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py
@@ -0,0 +1,114 @@
1#
2# Chris Lumens <clumens@redhat.com>
3#
4# Copyright 2005, 2006, 2007 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
24class FC3_Vnc(KickstartCommand):
25 removedKeywords = KickstartCommand.removedKeywords
26 removedAttrs = KickstartCommand.removedAttrs
27
28 def __init__(self, writePriority=0, *args, **kwargs):
29 KickstartCommand.__init__(self, writePriority, *args, **kwargs)
30 self.op = self._getParser()
31
32 self.enabled = kwargs.get("enabled", False)
33 self.password = kwargs.get("password", "")
34 self.connect = kwargs.get("connect", "")
35
36 def __str__(self):
37 retval = KickstartCommand.__str__(self)
38
39 if not self.enabled:
40 return retval
41
42 retval += "vnc"
43
44 if self.connect != "":
45 retval += " --connect=%s" % self.connect
46 if self.password != "":
47 retval += " --password=%s" % self.password
48
49 return retval + "\n"
50
51 def _getParser(self):
52 op = KSOptionParser()
53 op.add_option("--connect")
54 op.add_option("--password", dest="password")
55 return op
56
57 def parse(self, args):
58 self.enabled = True
59 (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
60 self._setToSelf(self.op, opts)
61 return self
62
63class FC6_Vnc(FC3_Vnc):
64 removedKeywords = FC3_Vnc.removedKeywords + ["connect"]
65 removedAttrs = FC3_Vnc.removedAttrs + ["connect"]
66
67 def __init__(self, writePriority=0, host="", port="", *args, **kwargs):
68 FC3_Vnc.__init__(self, writePriority, *args, **kwargs)
69 self.deleteRemovedAttrs()
70
71 self.host = kwargs.get("host", "")
72 self.port = kwargs.get("port", "")
73
74 def __str__(self):
75 retval = KickstartCommand.__str__(self)
76
77 if not self.enabled:
78 return retval
79
80 retval += "vnc"
81
82 if self.host != "":
83 retval += " --host=%s" % self.host
84
85 if self.port != "":
86 retval += " --port=%s" % self.port
87 if self.password != "":
88 retval += " --password=%s" % self.password
89
90 return retval + "\n"
91
92 def _getParser(self):
93 def connect_cb (option, opt_str, value, parser):
94 cargs = value.split(":")
95 parser.values.ensure_value("host", cargs[0])
96
97 if len(cargs) > 1:
98 parser.values.ensure_value("port", cargs[1])
99
100 op = FC3_Vnc._getParser(self)
101 op.add_option("--connect", action="callback", callback=connect_cb,
102 nargs=1, type="string")
103 op.add_option("--host", dest="host")
104 op.add_option("--port", dest="port")
105 return op
106
107class F9_Vnc(FC6_Vnc):
108 removedKeywords = FC6_Vnc.removedKeywords
109 removedAttrs = FC6_Vnc.removedAttrs
110
111 def _getParser(self):
112 op = FC6_Vnc._getParser(self)
113 op.remove_option("--connect")
114 return op