[yum-cvs] yum-utils/plugins/versionlock versionlock.py,1.4,1.5
Menno Smits
mjs at linux.duke.edu
Fri Jun 16 14:41:03 UTC 2006
Update of /home/groups/yum/cvs/yum-utils/plugins/versionlock
In directory login1.linux.duke.edu:/tmp/cvs-serv2589
Modified Files:
versionlock.py
Log Message:
- changed to UNIX line endings (has DOS line endings)
- removed config_hook() and use of registerOpt(). registerOpt() is only for
adding options to Yum's main configuration files. It is not required for the
plugin's own configuration file.
Index: versionlock.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/versionlock/versionlock.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- versionlock.py 19 Dec 2005 19:03:49 -0000 1.4
+++ versionlock.py 16 Jun 2006 14:41:01 -0000 1.5
@@ -1,59 +1,55 @@
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Library General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# by Panu Matilainen <pmatilai at laiskiainen.org>
-#
-
-from yum.constants import *
-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,)
-
-def config_hook(conduit):
- conduit.registerOpt('locklist', PLUG_OPT_STRING, PLUG_OPT_WHERE_MAIN, '')
-
-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 = urlgrabber.urlopen(location)
- for line in llfile.readlines():
- if line.startswith('#') or line.strip() == '':
- continue
- locklist.append(line.rstrip())
- llfile.close()
- except urlgrabber.grabber.URLGrabError, e:
- raise PluginYumExit('Unable to read version lock configuration: %s' % e)
-
- 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, e, v, r, a) = pkg.returnNevraTuple()
- if compareEVR(locked[pkg.name], (e, v, r)) != 0:
- conduit.delPackage(pkg)
- conduit.info(5, 'Excluding package %s due to version lock' % pkg)
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# by Panu Matilainen <pmatilai at laiskiainen.org>
+#
+
+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,)
+
+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 = urlgrabber.urlopen(location)
+ for line in llfile.readlines():
+ if line.startswith('#') or line.strip() == '':
+ continue
+ locklist.append(line.rstrip())
+ llfile.close()
+ except urlgrabber.grabber.URLGrabError, e:
+ raise PluginYumExit('Unable to read version lock configuration: %s' % e)
+
+ 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, e, v, r, a) = pkg.returnNevraTuple()
+ if compareEVR(locked[pkg.name], (e, v, r)) != 0:
+ conduit.delPackage(pkg)
+ conduit.info(5, 'Excluding package %s due to version lock' % pkg)
More information about the Yum-cvs-commits
mailing list