James Antill wrote:
 plugins/versionlock/versionlock.py |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 3a2d1fdf53635a8929693494b4fbacc2a5bf4545
Author: James Antill <[EMAIL PROTECTED]>
Date:   Wed Feb 20 01:40:25 2008 -0500

    Fix non-existant version lock file SNAFU

diff --git a/plugins/versionlock/versionlock.py 
b/plugins/versionlock/versionlock.py
index 664e887..0e558c2 100644
--- a/plugins/versionlock/versionlock.py
+++ b/plugins/versionlock/versionlock.py
@@ -20,6 +20,7 @@ from yum.plugins import TYPE_CORE
 from rpmUtils.miscutils import splitFilename, compareEVR
 import urlgrabber
 import urlgrabber.grabber
+import os
requires_api_version = '2.1'
 plugin_type = (TYPE_CORE,)
@@ -30,11 +31,15 @@ def vl_search(conduit, name):
     return conduit._base.pkgSack.searchNevra(name=name)
def exclude_hook(conduit):
-    conduit.info(2, 'Reading version lock configuration')
     locklist = []
     location = conduit.confString('main', 'locklist')
     if not location:
         raise PluginYumExit('Locklist not set')
+
+    if location.startswith('/') and not os.path.exists(location):
+        return # Don't die if the file doesn't exist, just treat as empty
+
+    conduit.info(2, 'Reading version lock configuration')
     try:
         llfile = urlgrabber.urlopen(location)
         for line in llfile.readlines():
commit cea2c7da444204049ba3b82ec66509bdec09773b
Author: James Antill <[EMAIL PROTECTED]>
Date:   Wed Feb 20 01:37:59 2008 -0500

    Redo versionlock logic for major speedup in non-update cases

diff --git a/plugins/versionlock/versionlock.py 
b/plugins/versionlock/versionlock.py
index c9242ac..664e887 100644
--- a/plugins/versionlock/versionlock.py
+++ b/plugins/versionlock/versionlock.py
@@ -24,6 +24,11 @@ import urlgrabber.grabber
 requires_api_version = '2.1'
 plugin_type = (TYPE_CORE,)
+def vl_search(conduit, name):
+    """ Search for packages with a particular name. """
+    # Note that conduit.getPackageByNevra _almost_ works enough, but doesn't
+    return conduit._base.pkgSack.searchNevra(name=name)
+
 def exclude_hook(conduit):
     conduit.info(2, 'Reading version lock configuration')
     locklist = []
@@ -40,19 +45,11 @@ def exclude_hook(conduit):
     except urlgrabber.grabber.URLGrabError, e:
         raise PluginYumExit('Unable to read version lock configuration: %s' % 
e)
- if not locklist:
-        return
-
-    pkgs = conduit.getPackages()
-    locked = {}
     for pkg in locklist:
         (n, v, r, e, a) = splitFilename("%s" % pkg)
if e == '': e = '0' - locked[n] = (e, v, r) - for pkg in pkgs:
-        if locked.has_key(pkg.name):
-            (n,a,e,v,r) = pkg.pkgtup
-            if compareEVR(locked[pkg.name], (e, v, r)) != 0:
+        for pkg in vl_search(conduit, n):
+            if compareEVR((pkg.epoch, pkg.version, pkg.release), (e, v, r)):
                 conduit.delPackage(pkg)
                 conduit.info(5, 'Excluding package %s due to version lock' % 
pkg)
_______________________________________________
https://lists.dulug.duke.edu/mailman/listinfo/yum-cvs-commits

It is by design that versionlock should break if the config file is missing, if you are running with version, you what it to fail if the config file is missing, else you lock packages will get updated without notice, if your config file get deleted by accident. This is why it is disabled by default some people doing 'yum install yum*', don't break their systems.
So please revert it, Panu feel very hard about it should work this way.

Tim
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to