[PATCH] Fix same arch duplicate checking in package-cleanup

Ville Skyttä <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
The attached patch fixes same-arch duplicate checking in package-cleanup.py in 
current yum-utils git.

Test case: install two versions of same package and same arch (possibly 
with --force), run ./package-cleanup.py -d.  I tested with tomcat-native on 
x86_64, F-9.

By the way, I think it's somewhat weird that isDuplicate(a1,a2) returns False 
if a1 and a2 are the same arch.  That code path isn't executed at all after 
this patch though.

Also, the singleLib/multiLib stuff doesn't list ppc or ppc64, should it?

_______________________________________________
Yum mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum
0001-Fix-same-arch-duplicate-checking.patch (text/x-diff, 1.3 KB)
From 8f549e5f6aa5663a9ac8973823cf8be76df05b11 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ville=20Skytt=C3=A4?= <[email protected]>
Date: Wed, 25 Mar 2009 00:21:59 +0200
Subject: [PATCH] Fix same arch duplicate checking.

---
 package-cleanup.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/package-cleanup.py b/package-cleanup.py
index 7b4646f..11d8415 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -161,15 +161,15 @@ def findDupes(my):
     for (n) in pkgdict.keys():
         # is more than one package with this name ?
         if len(pkgdict[(n)]) > 1:
-            archs = []
+            archs = set()
             for (e,v,r,a) in pkgdict[(n)]:
-                archs.append(a)
-            # If all packages with the same name has the same arch, then it is a dupe
+                archs.add(a)
+            # If all packages with the same name have the same arch, then it is a dupe
             if len(archs) == 1:
                 refined[(n)] = pkgdict[(n)]
             else:
-                a1 = archs[0]
-                for a2 in archs[1:]:
+                a1 = archs.pop()
+                for a2 in archs:
                     if isDuplicate(a1,a2):
                         refined[(n)] = pkgdict[(n)]
                             
-- 
1.6.0.6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.