[yum-commits] plugins/versionlock
zpavlas at osuosl.org
zpavlas at osuosl.org
Tue Apr 16 07:35:11 UTC 2013
plugins/versionlock/versionlock.py | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
New commits:
commit 83477af852d05253471c205a32c699a9b03889f9
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date: Mon Apr 15 11:17:33 2013 +0200
versionlock delete: match all names, not just envra
diff --git a/plugins/versionlock/versionlock.py b/plugins/versionlock/versionlock.py
index ddc5d73..dfe4dd3 100644
--- a/plugins/versionlock/versionlock.py
+++ b/plugins/versionlock/versionlock.py
@@ -56,6 +56,23 @@ def _read_locklist():
raise PluginYumExit('Unable to read version lock configuration: %s' % e)
return locklist
+def _match(ent, patterns):
+ # there should be an API for this in Yum
+ (n, v, r, e, a) = splitFilename(ent)
+ for name in (
+ '%s' % n,
+ '%s.%s' % (n, a),
+ '%s-%s' % (n, v),
+ '%s-%s-%s' % (n, v, r),
+ '%s-%s-%s.%s' % (n, v, r, a),
+ '%s:%s-%s-%s.%s' % (e, n, v, r, a),
+ '%s-%s:%s-%s.%s' % (n, e, v, r, a),
+ ):
+ for pat in patterns:
+ if fnmatch.fnmatch(name, pat):
+ return True
+ return False
+
class VersionLockCommand:
created = 1247693044
@@ -159,12 +176,7 @@ class VersionLockCommand:
out = os.fdopen(out, 'w', -1)
count = 0
for ent in _read_locklist():
- found = False
- for match in extcmds:
- if fnmatch.fnmatch(ent, match):
- found = True
- break
- if found:
+ if _match(ent, extcmds):
print "Deleting versionlock for:", ent
count += 1
continue
More information about the Yum-commits
mailing list