diff options
| author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:38:32 +0100 |
|---|---|---|
| committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:50:20 +0100 |
| commit | e2e6f6fe07049f33cb6348780fa975162752e421 (patch) | |
| tree | b1813295411235d1297a0ed642b1346b24fdfb12 /scripts/lib/mic/kickstart/custom_commands/micrepo.py | |
| download | poky-e2e6f6fe07049f33cb6348780fa975162752e421.tar.gz | |
initial commit of Enea Linux 3.1
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'scripts/lib/mic/kickstart/custom_commands/micrepo.py')
| -rw-r--r-- | scripts/lib/mic/kickstart/custom_commands/micrepo.py | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/scripts/lib/mic/kickstart/custom_commands/micrepo.py b/scripts/lib/mic/kickstart/custom_commands/micrepo.py new file mode 100644 index 0000000000..b31576e400 --- /dev/null +++ b/scripts/lib/mic/kickstart/custom_commands/micrepo.py | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | #!/usr/bin/python -tt | ||
| 2 | # | ||
| 3 | # Copyright (c) 2008, 2009, 2010 Intel, Inc. | ||
| 4 | # | ||
| 5 | # Yi Yang <yi.y.yang@intel.com> | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify it | ||
| 8 | # under the terms of the GNU General Public License as published by the Free | ||
| 9 | # Software Foundation; version 2 of the License | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, but | ||
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | # for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License along | ||
| 17 | # with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
| 18 | # Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 19 | |||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | from pykickstart.commands.repo import * | ||
| 24 | |||
| 25 | class Mic_RepoData(F8_RepoData): | ||
| 26 | |||
| 27 | def __init__(self, baseurl="", mirrorlist=None, name="", priority=None, | ||
| 28 | includepkgs=(), excludepkgs=(), save=False, proxy=None, | ||
| 29 | proxy_username=None, proxy_password=None, debuginfo=False, | ||
| 30 | source=False, gpgkey=None, disable=False, ssl_verify="yes", | ||
| 31 | nocache=False): | ||
| 32 | kw = {} | ||
| 33 | # F8_RepoData keywords | ||
| 34 | if includepkgs: | ||
| 35 | kw['includepkgs'] = includepkgs | ||
| 36 | if excludepkgs: | ||
| 37 | kw['excludepkgs'] = excludepkgs | ||
| 38 | |||
| 39 | #FC6_RepoData keywords | ||
| 40 | if baseurl: | ||
| 41 | kw['baseurl'] = baseurl | ||
| 42 | if mirrorlist: | ||
| 43 | kw['mirrorlist'] = mirrorlist | ||
| 44 | if name: | ||
| 45 | kw['name'] = name | ||
| 46 | |||
| 47 | F8_RepoData.__init__(self, **kw) | ||
| 48 | self.save = save | ||
| 49 | self.proxy = proxy | ||
| 50 | self.proxy_username = proxy_username | ||
| 51 | self.proxy_password = proxy_password | ||
| 52 | self.debuginfo = debuginfo | ||
| 53 | self.disable = disable | ||
| 54 | self.source = source | ||
| 55 | self.gpgkey = gpgkey | ||
| 56 | self.ssl_verify = ssl_verify.lower() | ||
| 57 | self.priority = priority | ||
| 58 | self.nocache = nocache | ||
| 59 | |||
| 60 | def _getArgsAsStr(self): | ||
| 61 | retval = F8_RepoData._getArgsAsStr(self) | ||
| 62 | |||
| 63 | if self.save: | ||
| 64 | retval += " --save" | ||
| 65 | if self.proxy: | ||
| 66 | retval += " --proxy=%s" % self.proxy | ||
| 67 | if self.proxy_username: | ||
| 68 | retval += " --proxyuser=%s" % self.proxy_username | ||
| 69 | if self.proxy_password: | ||
| 70 | retval += " --proxypasswd=%s" % self.proxy_password | ||
| 71 | if self.debuginfo: | ||
| 72 | retval += " --debuginfo" | ||
| 73 | if self.source: | ||
| 74 | retval += " --source" | ||
| 75 | if self.gpgkey: | ||
| 76 | retval += " --gpgkey=%s" % self.gpgkey | ||
| 77 | if self.disable: | ||
| 78 | retval += " --disable" | ||
| 79 | if self.ssl_verify: | ||
| 80 | retval += " --ssl_verify=%s" % self.ssl_verify | ||
| 81 | if self.priority: | ||
| 82 | retval += " --priority=%s" % self.priority | ||
| 83 | if self.nocache: | ||
| 84 | retval += " --nocache" | ||
| 85 | |||
| 86 | return retval | ||
| 87 | |||
| 88 | class Mic_Repo(F8_Repo): | ||
| 89 | def __init__(self, writePriority=0, repoList=None): | ||
| 90 | F8_Repo.__init__(self, writePriority, repoList) | ||
| 91 | |||
| 92 | def __str__(self): | ||
| 93 | retval = "" | ||
| 94 | for repo in self.repoList: | ||
| 95 | retval += repo.__str__() | ||
| 96 | |||
| 97 | return retval | ||
| 98 | |||
| 99 | def _getParser(self): | ||
| 100 | def list_cb (option, opt_str, value, parser): | ||
| 101 | for d in value.split(','): | ||
| 102 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 103 | |||
| 104 | op = F8_Repo._getParser(self) | ||
| 105 | op.add_option("--save", action="store_true", dest="save", | ||
| 106 | default=False) | ||
| 107 | op.add_option("--proxy", type="string", action="store", dest="proxy", | ||
| 108 | default=None, nargs=1) | ||
| 109 | op.add_option("--proxyuser", type="string", action="store", | ||
| 110 | dest="proxy_username", default=None, nargs=1) | ||
| 111 | op.add_option("--proxypasswd", type="string", action="store", | ||
| 112 | dest="proxy_password", default=None, nargs=1) | ||
| 113 | op.add_option("--debuginfo", action="store_true", dest="debuginfo", | ||
| 114 | default=False) | ||
| 115 | op.add_option("--source", action="store_true", dest="source", | ||
| 116 | default=False) | ||
| 117 | op.add_option("--disable", action="store_true", dest="disable", | ||
| 118 | default=False) | ||
| 119 | op.add_option("--gpgkey", type="string", action="store", dest="gpgkey", | ||
| 120 | default=None, nargs=1) | ||
| 121 | op.add_option("--ssl_verify", type="string", action="store", | ||
| 122 | dest="ssl_verify", default="yes") | ||
| 123 | op.add_option("--priority", type="int", action="store", dest="priority", | ||
| 124 | default=None) | ||
| 125 | op.add_option("--nocache", action="store_true", dest="nocache", | ||
| 126 | default=False) | ||
| 127 | return op | ||
