[yum-git] plugins/tmprepo yum-utils.spec

James Antill james at linux.duke.edu
Mon Jul 28 22:05:29 UTC 2008


 plugins/tmprepo/tmprepo.py |   37 ++++++++++++++++++++++++++-----------
 yum-utils.spec             |    2 +-
 2 files changed, 27 insertions(+), 12 deletions(-)

New commits:
commit 91c0a9bd0d002bb0775417dc4d9c7511ea1e8f5c
Author: James Antill <james at and.org>
Date:   Mon Jul 28 18:05:26 2008 -0400

    Update tmprepo to use CaselessSelectionOption() and understand the new gpgcheck

diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index 845cfc4..c408a0d 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -34,36 +34,34 @@ import os
 import shutil
 import time
 
+from yum.config import CaselessSelectionOption
+
 requires_api_version = '2.5'
 plugin_type = (TYPE_INTERACTIVE,)
 
 def make_validate(log, gpgcheck):
     def tvalidate(repo):
-        if gpgcheck.lower() not in ('false', 'no', '0'):
+        if gpgcheck != 'none':
 
-            if gpgcheck.lower() not in ('packages', 'pkgs',
-                                        '1', 'yes', 'true',
-                                        'repo', 'repository'):
+            if gpgcheck not in ('packages', 'all', 'repo'):
                 log.warn("GPGcheck set to unknown value: %s" % gpgcheck)
                 return False
 
-            if repo.gpgcheck not in ('packages', 'true', 'repo'):
+            if repo.gpgcheck not in ('packages', 'all', 'repo'):
                 log.warn("Repo %s GPGcheck set to unknown value: %s" %
                          (repo, gpgcheck))
                 return False
 
             # Don't ever allow them to set gpgcheck='false'
-            if repo.gpgcheck == 'false':
+            if repo.gpgcheck == 'none':
                 log.warn("Repo %s tried to set gpgcheck=false" % repo)
                 return False
 
             # Now do the more complicated comparisons...
-            if (gpgcheck.lower() in ('packages', 'pkgs', '1', 'yes', 'true') and
-                repo.gpgcheck == 'repo'):
+            if gpgcheck() in ('packages', 'all') and repo.gpgcheck == 'repo':
                 log.warn("Repo %s tried to set gpgcheck=repository" % repo)
                 return False
-            if (gpgcheck.lower() in ('repository', 'repo', '1', 'yes', 'true') and
-                repo.gpgcheck == 'packages'):
+            if gpgcheck in ('repo', 'all') and repo.gpgcheck == 'packages':
                 log.warn("Repo %s tried to set gpgcheck=packages" % repo)
                 return False
             
@@ -194,8 +192,25 @@ def config_hook(conduit):
                       help="keep created direcotry based tmp. repos.")
     #  We default to repository for actual repo files, because that's the most
     # secure, but packages for local dirs./files
-    rgpgcheck  = conduit.confString('main', 'remote_gpgcheck', default='repo')
+    rgpgcheck = conduit.confString('main', 'remote_gpgcheck', default='repo')
     lgpgcheck = conduit.confString('main', 'local_gpgcheck', default='packages')
+
+    rgpgcheck = CaselessSelectionOption('none',
+                                       ('none', 'all', 'packages', 'repo'),
+                                       {'0'          : 'none',
+                                        'no'         : 'none',
+                                        '1'          : 'all',
+                                        'yes'        : 'all',
+                                        'pkgs'       : 'packages',
+                                        'repository' : 'repo'}).parse(rgpgcheck)
+    lgpgcheck = CaselessSelectionOption('none',
+                                       ('none', 'all', 'packages', 'repo'),
+                                       {'0'          : 'none',
+                                        'no'         : 'none',
+                                        '1'          : 'all',
+                                        'yes'        : 'all',
+                                        'pkgs'       : 'packages',
+                                        'repository' : 'repo'}).parse(lgpgcheck)
     def_tmp_repos_cleanup = conduit.confBool('main', 'cleanup', default=False)
 
 _tmprepo_done = False
diff --git a/yum-utils.spec b/yum-utils.spec
index ae0defa..758b08a 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -232,7 +232,7 @@ each category, if any were specified.
 %package -n yum-tmprepo
 Summary: Yum plugin to add temporary repositories
 Group: System Environment/Base
-Requires: yum >= 3.2.11
+Requires: yum >= 3.2.18
 Requires: createrepo
 
 %description -n yum-tmprepo



More information about the Yum-cvs-commits mailing list