[yum-git] 2 commits - plugins/versionlock
James Antill
james at linux.duke.edu
Mon Jul 28 03:25:56 UTC 2008
plugins/versionlock/versionlock.conf | 2 ++
plugins/versionlock/versionlock.py | 27 +++++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
New commits:
commit b280cc1e1d5874d91c117549ec741f7fed9a1232
Author: James Antill <james at and.org>
Date: Sun Jul 27 23:22:12 2008 -0400
Optionally do obsoletes processing for versionlock
diff --git a/plugins/versionlock/versionlock.conf b/plugins/versionlock/versionlock.conf
index 461b114..4e997da 100644
--- a/plugins/versionlock/versionlock.conf
+++ b/plugins/versionlock/versionlock.conf
@@ -1,3 +1,5 @@
[main]
enabled = 1
locklist = /etc/yum/pluginconf.d/versionlock.list
+# Uncomment this to lock out "upgrade via. obsoletes" etc. (slower)
+# follow_obsoletes = 1
diff --git a/plugins/versionlock/versionlock.py b/plugins/versionlock/versionlock.py
index 8da47a0..0de81e8 100644
--- a/plugins/versionlock/versionlock.py
+++ b/plugins/versionlock/versionlock.py
@@ -52,6 +52,17 @@ def exclude_hook(conduit):
e = '0'
pkgs.setdefault(n, []).append((e, v, r))
+ if conduit.confBool('main', 'follow_obsoletes', default=False):
+ # If anything obsoletes something that we have versionlocked ... then
+ # remove all traces of that too.
+ obs = conduit._base.pkgSack.returnObsoletes()
+ for ob in obs:
+ for po in obs[ob]:
+ if po.name not in pkgs:
+ continue
+ # If anyone versions a pkg this, they need a good kicking
+ pkgs.setdefault(ob[0], []).append(('0', '0', '0'))
+
for pkgname in pkgs:
for pkg in vl_search(conduit, pkgname):
found = False
commit ceaa09922c95ecd39b2a07eb52c05abcc6a39828
Author: James Antill <james at and.org>
Date: Sun Jul 27 23:20:12 2008 -0400
Allow locking to multiple EVR's
diff --git a/plugins/versionlock/versionlock.py b/plugins/versionlock/versionlock.py
index 664e887..8da47a0 100644
--- a/plugins/versionlock/versionlock.py
+++ b/plugins/versionlock/versionlock.py
@@ -45,11 +45,19 @@ def exclude_hook(conduit):
except urlgrabber.grabber.URLGrabError, e:
raise PluginYumExit('Unable to read version lock configuration: %s' % e)
- for pkg in locklist:
- (n, v, r, e, a) = splitFilename("%s" % pkg)
+ pkgs = {}
+ for ent in locklist:
+ (n, v, r, e, a) = splitFilename(ent)
if e == '':
e = '0'
- for pkg in vl_search(conduit, n):
- if compareEVR((pkg.epoch, pkg.version, pkg.release), (e, v, r)):
+ pkgs.setdefault(n, []).append((e, v, r))
+
+ for pkgname in pkgs:
+ for pkg in vl_search(conduit, pkgname):
+ found = False
+ for tup in pkgs[pkgname]:
+ if not compareEVR((pkg.epoch, pkg.version, pkg.release), tup):
+ found = True
+ if not found:
conduit.delPackage(pkg)
conduit.info(5, 'Excluding package %s due to version lock' % pkg)
More information about the Yum-cvs-commits
mailing list