[yum-cvs] yum-utils/plugins/versionlock versionlock.py,1.3,1.4

Panu Matilainen pmatilai at linux.duke.edu
Mon Dec 19 19:03:51 UTC 2005


Update of /home/groups/yum/cvs/yum-utils/plugins/versionlock
In directory login1.linux.duke.edu:/tmp/cvs-serv5686

Modified Files:
	versionlock.py 
Log Message:
- allow the lockfile location to be specified as an url
- lockfile format is envra


Index: versionlock.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/versionlock/versionlock.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- versionlock.py	25 Jul 2005 16:31:04 -0000	1.3
+++ versionlock.py	19 Dec 2005 19:03:49 -0000	1.4
@@ -19,6 +19,8 @@
 from yum.plugins import PluginYumExit
 from yum.plugins import TYPE_CORE
 from rpmUtils.miscutils import splitFilename, compareEVR
+import urlgrabber
+import urlgrabber.grabber
 
 requires_api_version = '2.1'
 plugin_type = (TYPE_CORE,)
@@ -29,19 +31,23 @@
 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')
     try:
-        llfile = open(conduit.confString('main', 'locklist'))
+        llfile = urlgrabber.urlopen(location)
         for line in llfile.readlines():
+            if line.startswith('#') or line.strip() == '':
+                continue
             locklist.append(line.rstrip())
         llfile.close()
-    except IOError:
-        raise PluginYumExit('Unable to read version lock configuration')
+    except urlgrabber.grabber.URLGrabError, e:
+        raise PluginYumExit('Unable to read version lock configuration: %s' % e)
 
     pkgs = conduit.getPackages()
     locked = {}
     for pkg in locklist:
-        # Arch doesn't matter but splitFilename wants it so fake it...
-        (n, v, r, e, a) = splitFilename("%s.arch" % pkg)
+        (n, v, r, e, a) = splitFilename("%s" % pkg)
         if e == '': 
             e = '0'
         locked[n] = (e, v, r) 




More information about the Yum-cvs-commits mailing list