[yum-cvs] yum/yum packageSack.py,1.23,1.24
Seth Vidal
skvidal at linux.duke.edu
Sun Jan 21 20:13:56 UTC 2007
Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv17477
Modified Files:
packageSack.py
Log Message:
port forward the obsoletes processing patch
Index: packageSack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/packageSack.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- packageSack.py 19 Dec 2006 03:43:31 -0000 1.23
+++ packageSack.py 21 Jan 2007 20:13:54 -0000 1.24
@@ -246,10 +246,28 @@
"""return list of package obsoleting the name (any evr and flag)"""
return self._computeAggregateListResult("searchObsoletes", name)
- def returnObsoletes(self):
+ def returnObsoletes(self, newest=False):
"""returns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]"""
- return self._computeAggregateDictResult("returnObsoletes")
-
+ if not newest:
+ return self._computeAggregateDictResult("returnObsoletes")
+
+ # get the dict back
+ obsdict = self._computeAggregateDictResult("returnObsoletes")
+ # get a sack of the newest pkgs
+ obstups = obsdict.keys()
+ newest_tup_dict = {}
+ for pkg in self.returnNewestByName():
+ if not newest_tup_dict.has_key(pkg.pkgtup):
+ newest_tup_dict[pkg.pkgtup] = 1
+
+ # go through each of the keys of the obs dict and see if it is in the
+ # sack of newest pkgs - if it is not - remove the entry
+ for obstup in obstups:
+ if not newest_tup_dict.has_key(obstup):
+ del obsdict[obstup]
+
+ return obsdict
+
def searchFiles(self, file):
"""return list of packages by filename"""
return self._computeAggregateListResult("searchFiles", file)
@@ -432,14 +450,14 @@
"""returns a dict of obsoletes dict[obsoleting pkgtuple] = [list of obs]"""
obs = {}
for po in self.returnPackages():
- if len(po.returnPrco('obsoletes')) == 0:
+ if len(po.obsoletes) == 0:
continue
if not obs.has_key(po.pkgtup):
- obs[po.pkgtup] = po.returnPrco('obsoletes')
+ obs[po.pkgtup] = po.obsoletes
else:
- obs[po.pkgtup].extend(po.returnPrco('obsoletes'))
-
+ obs[po.pkgtup].extend(po.obsoletes)
+
return obs
def searchFiles(self, file):
@@ -595,8 +613,14 @@
return highdict[name]
else:
raise PackageSackError, 'No Package Matching %s' % name
-
- return highdict.values()
+
+ #this is a list of lists - break it back out into a single list
+ returnlist = []
+ for polst in highdict.values():
+ for po in polst:
+ returnlist.append(po)
+
+ return returnlist
def simplePkgList(self):
"""returns a list of pkg tuples (n, a, e, v, r) optionally from a single repoid"""
More information about the Yum-cvs-commits
mailing list