[yum-cvs] yum/yum __init__.py,1.196.2.8,1.196.2.9
Jeremy Katz
katzj at linux.duke.edu
Wed May 24 14:38:35 UTC 2006
Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv2474/yum
Modified Files:
Tag: yum-2_6_X
__init__.py
Log Message:
keeping around older Extras packages, we can end up with some
pretty pathological multilib cases around noarch packages.
Having both x86_64 and noarch of the same package installed is
non-sensical. But we want to allow switching from native -> noarch and
back. So, let's take into account that noarch is a third case beyond
base arch and compat arch.
With that, we get to where there are four basic cases of newest packages
1) No noarch packages. This ends up with what we have today where you
install the base arch and the compat arch if available
2) Only noarch packages. This also ends up like present
3) Noarch package that's newer than the basearch package. This means
that we want the noarch package and not the basearch or compat-arch
4) Noarch package that's older than the basearch package. This means we
want the basearch and compat-arch if it exists
rh #189998
Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.196.2.8
retrieving revision 1.196.2.9
diff -u -r1.196.2.8 -r1.196.2.9
--- __init__.py 24 May 2006 14:15:49 -0000 1.196.2.8
+++ __init__.py 24 May 2006 14:38:32 -0000 1.196.2.9
@@ -1632,21 +1632,46 @@
compatArchList = rpmUtils.arch.getArchList(arch)
multiLib = []
singleLib = []
+ noarch = []
for po in pkglist:
if po.arch not in compatArchList:
continue
+ elif po.arch in ("noarch"):
+ noarch.append(po)
elif rpmUtils.arch.isMultiLibArch(arch=po.arch):
multiLib.append(po)
else:
singleLib.append(po)
- # we should have two lists now - one of singleLib packages
- # one of multilib packages
- # go through each one and find the best package(s)
- for pkglist in [multiLib, singleLib]:
- best = self._bestPackageFromList(pkglist)
- if best is not None:
- returnlist.append(best)
+ # we now have three lists. find the best package(s) of each
+ multi = self._bestPackageFromList(multiLib)
+ single = self._bestPackageFromList(singleLib)
+ no = self._bestPackageFromList(noarch)
+
+ # now, to figure out which arches we actually want
+ # if there aren't noarch packages, it's easy. multi + single
+ if no is None:
+ if multi: returnlist.append(multi)
+ if single: returnlist.append(single)
+ # if there's a noarch and it's newer than the multilib, we want
+ # just the noarch. otherwise, we want multi + single
+ elif multi:
+ best = self._bestPackageFromList([multi,no])
+ if best.arch == "noarch":
+ returnlist.append(no)
+ else:
+ if multi: returnlist.append(multi)
+ if single: returnlist.append(single)
+ # similar for the non-multilib case
+ elif single:
+ best = self._bestPackageFromList([single,no])
+ if best.arch == "noarch":
+ returnlist.append(no)
+ else:
+ returnlist.append(single)
+ # if there's not a multi or single lib, then we want the noarch
+ else:
+ returnlist.append(no)
return returnlist
More information about the Yum-cvs-commits
mailing list