3 # Yi Yang <yi.y.yang@intel.com>
5 # Copyright 2008, 2009, 2010 Intel, Inc.
7 # This copyrighted material is made available to anyone wishing to use, modify,
8 # copy, or redistribute it subject to the terms and conditions of the GNU
9 # General Public License v.2. This program is distributed in the hope that it
10 # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
11 # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 # See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # this program; if not, write to the Free Software Foundation, Inc., 51
16 # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat
17 # trademarks that are incorporated in the source code or documentation are not
18 # subject to the GNU General Public License and may only be used or replicated
19 # with the express permission of Red Hat, Inc.
21 from pykickstart.base import *
22 from pykickstart.errors import *
23 from pykickstart.options import *
24 from pykickstart.commands.repo import *
26 class Moblin_RepoData(F8_RepoData):
27 def __init__(self, baseurl="", mirrorlist="", name="", priority=None,
28 includepkgs=[], excludepkgs=[], save=False, proxy=None,
29 proxy_username=None, proxy_password=None, debuginfo=False, source=False, gpgkey=None, disable=False):
30 F8_RepoData.__init__(self, baseurl=baseurl, mirrorlist=mirrorlist,
31 name=name, includepkgs=includepkgs,
32 excludepkgs=excludepkgs)
35 self.proxy_username = proxy_username
36 self.proxy_password = proxy_password
37 self.debuginfo = debuginfo
38 self.disable = disable
42 def _getArgsAsStr(self):
43 retval = F8_RepoData._getArgsAsStr(self)
48 retval += " --proxy=%s" % self.proxy
49 if self.proxy_username:
50 retval += " --proxyuser=%s" % self.proxy_username
51 if self.proxy_password:
52 retval += " --proxypasswd=%s" % self.proxy_password
54 retval += " --debuginfo"
58 retval += " --gpgkey=%s" % self.gpgkey
60 retval += " --disable"
64 class Moblin_Repo(F8_Repo):
65 def __init__(self, writePriority=0, repoList=None):
66 F8_Repo.__init__(self, writePriority, repoList)
70 for repo in self.repoList:
71 retval += repo.__str__()
76 def list_cb (option, opt_str, value, parser):
77 for d in value.split(','):
78 parser.values.ensure_value(option.dest, []).append(d)
80 op = F8_Repo._getParser(self)
81 op.add_option("--save", action="store_true", dest="save",
83 op.add_option("--proxy", type="string", action="store", dest="proxy",
84 default=None, nargs=1)
85 op.add_option("--proxyuser", type="string", action="store", dest="proxy_username",
86 default=None, nargs=1)
87 op.add_option("--proxypasswd", type="string", action="store", dest="proxy_password",
88 default=None, nargs=1)
89 op.add_option("--debuginfo", action="store_true", dest="debuginfo",
91 op.add_option("--source", action="store_true", dest="source",
93 op.add_option("--disable", action="store_true", dest="disable",
95 op.add_option("--gpgkey", type="string", action="store", dest="gpgkey",
96 default=None, nargs=1)