[yum-git] Branch 'yum-3_2_X' - shell.py yumcommands.py yum/config.py yum/__init__.py

James Antill james at linux.duke.edu
Fri Jul 25 14:36:04 UTC 2008


 shell.py        |   12 +++++++++---
 yum/__init__.py |    2 +-
 yum/config.py   |   11 +++++++----
 yumcommands.py  |    2 +-
 4 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit f6904f0bd329e536680b2bb9cdfa6dfc3292c74d
Author: James Antill <james at and.org>
Date:   Fri Jul 25 10:35:24 2008 -0400

     Use the mapper for gpgcheck false/true, and tidy up the using code.

diff --git a/shell.py b/shell.py
index 9c0cb4b..ff9960b 100644
--- a/shell.py
+++ b/shell.py
@@ -236,9 +236,15 @@ class YumShell(cmd.Cmd):
                     getattr(self.base.conf, cmd))
             else:
                 value = opts[0]
-                if value.lower() not in ('0', 'no', 'false',
-                                         '1', 'yes', 'true',
-                                         'packages', 'repository'):
+                if value.lower() in ('0', 'no'):
+                    value = 'false'
+                if value.lower() in ('1', 'yes'):
+                    value = 'true'
+                if value.lower() == 'repository':
+                    value = 'repo'
+                if value.lower() == 'pkgs':
+                    value = 'packages'
+                if value.lower() not in ('false', 'true', 'packages', 'repo'):
                     self.logger.critical('Value %s for %s is not a GPGcheck value', value, cmd)
                     return False
                 setattr(self.base.conf, cmd, value.lower())
diff --git a/yum/__init__.py b/yum/__init__.py
index 3eaf136..760fc85 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 in ('1', 'yes', 'true', 'packages'):
+        if check in ('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 e5fe0c3..cab9972 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -624,10 +624,13 @@ class YumConf(StartupConf):
     diskspacecheck = BoolOption(True)
     overwrite_groups = BoolOption(False)
     keepalive = BoolOption(True)
-    gpgcheck = CaselessSelectionOption('false', ('0', 'no', 'false',
-                                                 '1', 'yes', 'true',
-                                                 'packages', 'repo'),
-                                       {'pkgs'       : 'packages',
+    gpgcheck = CaselessSelectionOption('false',
+                                       ('false', 'true', 'packages', 'repo'),
+                                       {'0'          : 'false',
+                                        'no'         : 'false',
+                                        '1'          : 'true',
+                                        'yes'        : 'true',
+                                        'pkgs'       : 'packages',
                                         'repository' : 'repo'})
     obsoletes = BoolOption(False)
     showdupesfromrepos = BoolOption(False)
diff --git a/yumcommands.py b/yumcommands.py
index 84c42e3..50a210a 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 not in ('0', 'no', 'false') and repo.gpgkey == '':
+            if repo.gpgcheck != '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