[yum-git] Branch 'yum-3_2_X' - cli.py shell.py yumcommands.py yum/config.py yum/__init__.py
James Antill
james at linux.duke.edu
Fri Jul 25 13:54:53 UTC 2008
cli.py | 4 ++--
shell.py | 16 +++++++++++++++-
yum/__init__.py | 2 +-
yum/config.py | 12 ++++++++++--
yumcommands.py | 2 +-
5 files changed, 29 insertions(+), 7 deletions(-)
New commits:
commit f43a333a21a9e3fe2d1e5e9dce10520aac677ba2
Author: James Antill <james at and.org>
Date: Fri Jul 25 09:54:34 2008 -0400
Convert the gpgcheck option to have all the options for repomd.xml signing
diff --git a/cli.py b/cli.py
index e536ec6..d40e4b6 100644
--- a/cli.py
+++ b/cli.py
@@ -1077,9 +1077,9 @@ class YumOptionParser(OptionParser):
# Disable all gpg key checking, if requested.
if opts.nogpgcheck:
- self.base.conf.gpgcheck = False
+ self.base.conf.gpgcheck = 'false'
for repo in self.base.repos.listEnabled():
- repo.gpgcheck = False
+ repo.gpgcheck = 'false'
except ValueError, e:
self.logger.critical(_('Options Error: %s'), e)
diff --git a/shell.py b/shell.py
index b21c402..9c0cb4b 100644
--- a/shell.py
+++ b/shell.py
@@ -214,7 +214,7 @@ class YumShell(cmd.Cmd):
elif cmd == 'errorlevel':
logginglevels.setErrorLevel(val)
# bools
- elif cmd in ['gpgcheck', 'obsoletes', 'assumeyes']:
+ elif cmd in ['obsoletes', 'assumeyes']:
opts = self._shlex_split(args)
if not opts:
self.verbose_logger.log(logginglevels.INFO_2, '%s: %s', cmd,
@@ -229,6 +229,20 @@ class YumShell(cmd.Cmd):
if cmd == 'obsoletes':
self.base.up = None
+ elif cmd in ['gpgcheck']:
+ opts = self._shlex_split(args)
+ if not opts:
+ self.verbose_logger.log(logginglevels.INFO_2, '%s: %s', cmd,
+ getattr(self.base.conf, cmd))
+ else:
+ value = opts[0]
+ if value.lower() not in ('0', 'no', 'false',
+ '1', 'yes', 'true',
+ 'packages', 'repository'):
+ self.logger.critical('Value %s for %s is not a GPGcheck value', value, cmd)
+ return False
+ setattr(self.base.conf, cmd, value.lower())
+
elif cmd in ['exclude']:
args = args.replace(',', ' ')
opts = self._shlex_split(args)
diff --git a/yum/__init__.py b/yum/__init__.py
index a4cf4f8..3eaf136 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1219,7 +1219,7 @@ class YumBase(depsolve.Depsolve):
check = repo.gpgcheck
hasgpgkey = not not repo.gpgkey
- if check:
+ if check in ('1', 'yes', 'true', 'packages'):
ts = self.rpmdb.readOnlyTS()
sigresult = rpmUtils.miscutils.checkSig(ts, po.localPkg())
localfn = os.path.basename(po.localPkg())
diff --git a/yum/config.py b/yum/config.py
index eca8200..1708d50 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -340,6 +340,13 @@ class SelectionOption(Option):
raise ValueError('"%s" is not an allowed value' % s)
return s
+class CaselessSelectionOption(SelectionOption):
+ ''' Mainly for compat. with BoolOption, works like SelectionOption but
+ lowers input case. '''
+
+ def parse(self, s):
+ return super(SelectionOption, self).parse(default, s.lower())
+
class BytesOption(Option):
"""
@@ -429,7 +436,6 @@ class ThrottleOption(BytesOption):
else:
return BytesOption.parse(self, s)
-
class BaseConfig(object):
'''
Base class for storing configuration definitions. Subclass when creating
@@ -615,7 +621,9 @@ class YumConf(StartupConf):
diskspacecheck = BoolOption(True)
overwrite_groups = BoolOption(False)
keepalive = BoolOption(True)
- gpgcheck = BoolOption(False)
+ gpgcheck = CaselessSelectionOption('false', ('0', 'no', 'false',
+ '1', 'yes', 'true',
+ 'packages', 'repository'))
obsoletes = BoolOption(False)
showdupesfromrepos = BoolOption(False)
enabled = BoolOption(True)
diff --git a/yumcommands.py b/yumcommands.py
index 7241809..84c42e3 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -42,7 +42,7 @@ def checkRootUID(base):
def checkGPGKey(base):
if not base.gpgKeyCheck():
for repo in base.repos.listEnabled():
- if repo.gpgcheck and repo.gpgkey == '':
+ if repo.gpgcheck not in ('0', 'no', 'false') and repo.gpgkey == '':
msg = _("""
You have enabled checking of packages via GPG keys. This is a good thing.
However, you do not have any GPG public keys installed. You need to download
More information about the Yum-cvs-commits
mailing list