Rework the depsolving just a bit

We get a list out of the yum function, so
treat it as a list, don't just pick the first
package.
This commit is contained in:
jkeating@reducto.boston.redhat.com 2007-01-24 16:27:28 -05:00 committed by Jesse Keating
parent 5b4458bddc
commit 147ed75d9c

View File

@ -42,7 +42,7 @@ class Gather(yum.YumBase):
self.srpmlist = [] self.srpmlist = []
def _provideToPkg(self, req): #this is stolen from Anaconda def _provideToPkg(self, req): #this is stolen from Anaconda
best = None bestlist = None
(r, f, v) = req (r, f, v) = req
satisfiers = [] satisfiers = []
@ -52,13 +52,13 @@ class Gather(yum.YumBase):
# care of the case that we select, eg, kernel-smp and then # care of the case that we select, eg, kernel-smp and then
# have something which requires kernel # have something which requires kernel
if self.tsInfo.getMembers(po.pkgtup): if self.tsInfo.getMembers(po.pkgtup):
return po return [po]
if po not in satisfiers: if po not in satisfiers:
satisfiers.append(po) satisfiers.append(po)
if satisfiers: if satisfiers:
best = self.bestPackagesFromList(satisfiers)[0] bestlist = self.bestPackagesFromList(satisfiers)
return best return bestlist
return None return None
def getPackageDeps(self, po): def getPackageDeps(self, po):
@ -82,14 +82,15 @@ class Gather(yum.YumBase):
if req in provs: if req in provs:
continue continue
dep = self._provideToPkg(req) deps = self._provideToPkg(req)
if dep is None: if deps is None:
self.logger.warning("Unresolvable dependency %s in %s" % (r, po.name)) self.logger.warning("Unresolvable dependency %s in %s" % (r, po.name))
continue continue
if not pkgresults.has_key(dep): for dep in deps:
pkgresults[dep] = None if not pkgresults.has_key(dep):
self.tsInfo.addInstall(dep) pkgresults[dep] = None
self.tsInfo.addInstall(dep)
return pkgresults.keys() return pkgresults.keys()