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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?
From 8f549e5f6aa5663a9ac8973823cf8be76df05b11 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@xxxxxx>
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

_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux