[yum-commits] package-cleanup.py
Tim Lauridsen
timlau at osuosl.org
Thu Mar 5 16:57:11 UTC 2009
package-cleanup.py | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
New commits:
commit dc31a0e910881053579cf97407398213360fdf46
Author: Tim Lauridsen <tim at naboo.local>
Date: Thu Mar 5 17:53:53 2009 +0100
make package-cleanup handle other kind of arch dupes (Ex. i386 & i586) and make it work this time
diff --git a/package-cleanup.py b/package-cleanup.py
index f61f7ae..60d1bf7 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -121,6 +121,21 @@ def buildProviderList(my, pkgs, reportProblems):
sys.exit(0)
return provsomething
+singleLib = ['i386','i486','i586','i686','noarch'] # single lib duplicates
+multiLib = ['x86_64','noarch'] # multi lib duplicates
+
+def isDuplicate(a1,a2):
+ """ check is a1 is a duplicate arch to a2 """
+ dup = False
+ if a1 == a2:
+ dup = False
+ elif a1 in singleLib and a2 in singleLib:
+ dup = True
+ elif a1 in multiLib and a2 in multiLib:
+ dup = True
+ return dup
+
+
def findDupes(my):
"""takes a yum base object prints out a list of package duplicates.
These typically happen when an update transaction is left half-completed"""
@@ -149,12 +164,10 @@ def findDupes(my):
if len(archs) == 1:
refined[(n)] = pkgdict[(n)]
else:
- for a in archs: # All archs with same name
- for ca in rpmUtils.arch.getArchList(a): # get the compatible arch
- if ca == a:
- continue
- if ca in archs: # If another compatible is in the archs, then it is a dupe
- refined[(n)] = pkgdict[(n)]
+ a1 = archs[0]
+ for a2 in archs[1:]:
+ if isDuplicate(a1,a2):
+ refined[(n)] = pkgdict[(n)]
del pkgdict
More information about the Yum-commits
mailing list