- Change how depsolving is done
- Get all potential matches for a dep, instead of our 'best' our 'best' may not be the same as install time best. - Remove anaconda code, use direct yum functions to get deps - Use a True/False flag to depsolve instead of iterating over a dict. - Log what packages are being added for which reasons. - Also fix a think-o with the false negative unmatched workaround.
This commit is contained in:
parent
23e40be9ee
commit
003ceaa7be
@ -5,6 +5,13 @@
|
|||||||
- Get all potential matches for deps, let install time figure
|
- Get all potential matches for deps, let install time figure
|
||||||
the best one to use.
|
the best one to use.
|
||||||
- Work around false positive 'unmatched' packages (globs are fun)
|
- Work around false positive 'unmatched' packages (globs are fun)
|
||||||
|
- Change how depsolving is done
|
||||||
|
- Get all potential matches for a dep, instead of our 'best'
|
||||||
|
our 'best' may not be the same as install time best.
|
||||||
|
- Remove anaconda code, use direct yum functions to get deps
|
||||||
|
- Use a True/False flag to depsolve instead of iterating over
|
||||||
|
a dict.
|
||||||
|
- Log what packages are being added for which reasons.
|
||||||
|
|
||||||
* Tue Mar 14 2007 Jesse Keating <jkeating@redhat.com>
|
* Tue Mar 14 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
- Do things faster/smarter if we've only asked for one disc
|
- Do things faster/smarter if we've only asked for one disc
|
||||||
|
@ -72,10 +72,8 @@ class Gather(yum.YumBase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def getPackageDeps(self, po):
|
def getPackageDeps(self, po):
|
||||||
"""Return the dependencies for a given package, as well
|
"""Add the dependencies for a given package to the
|
||||||
possible solutions for those dependencies.
|
transaction info"""
|
||||||
|
|
||||||
Returns the deps as a list"""
|
|
||||||
|
|
||||||
|
|
||||||
if not self.config.has_option('default', 'quiet'):
|
if not self.config.has_option('default', 'quiet'):
|
||||||
@ -83,7 +81,6 @@ class Gather(yum.YumBase):
|
|||||||
|
|
||||||
reqs = po.requires
|
reqs = po.requires
|
||||||
provs = po.provides
|
provs = po.provides
|
||||||
pkgresults = {}
|
|
||||||
|
|
||||||
for req in reqs:
|
for req in reqs:
|
||||||
if self.resolved_deps.has_key(req):
|
if self.resolved_deps.has_key(req):
|
||||||
@ -96,18 +93,16 @@ class Gather(yum.YumBase):
|
|||||||
|
|
||||||
deps = self.whatProvides(r, f, v).returnPackages()
|
deps = self.whatProvides(r, f, v).returnPackages()
|
||||||
if deps 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.%s" % (r, po.name, po.arch))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
if not pkgresults.has_key(dep):
|
|
||||||
pkgresults[dep] = None
|
|
||||||
self.tsInfo.addInstall(dep)
|
self.tsInfo.addInstall(dep)
|
||||||
|
if not self.config.has_option('default', 'quiet'):
|
||||||
|
self.logger.info('Added %s.%s for %s.%s' % (dep.name, dep.arch, po.name, po.arch))
|
||||||
|
|
||||||
self.resolved_deps[req] = None
|
self.resolved_deps[req] = None
|
||||||
|
|
||||||
return pkgresults.keys()
|
|
||||||
|
|
||||||
def getPackagesFromGroup(self, group):
|
def getPackagesFromGroup(self, group):
|
||||||
"""Get a list of package names from a comps object
|
"""Get a list of package names from a comps object
|
||||||
|
|
||||||
@ -168,9 +163,9 @@ class Gather(yum.YumBase):
|
|||||||
Returns a list of package objects"""
|
Returns a list of package objects"""
|
||||||
|
|
||||||
|
|
||||||
unprocessed_pkgs = {} # list of packages yet to depsolve ## Use dicts for speed
|
|
||||||
final_pkgobjs = {} # The final list of package objects
|
final_pkgobjs = {} # The final list of package objects
|
||||||
searchlist = [] # The list of package names/globs to search for
|
searchlist = [] # The list of package names/globs to search for
|
||||||
|
matchdict = {} # A dict of objects to names
|
||||||
|
|
||||||
grouplist = []
|
grouplist = []
|
||||||
excludelist = []
|
excludelist = []
|
||||||
@ -216,34 +211,32 @@ class Gather(yum.YumBase):
|
|||||||
(exactmatched, matched, unmatched) = yum.packages.parsePackages(self.pkgSack.returnPackages(), searchlist, casematch=1)
|
(exactmatched, matched, unmatched) = yum.packages.parsePackages(self.pkgSack.returnPackages(), searchlist, casematch=1)
|
||||||
matches = exactmatched + matched
|
matches = exactmatched + matched
|
||||||
|
|
||||||
|
# Populate a dict of package objects to their names
|
||||||
|
for match in matches:
|
||||||
|
matchdict[match.name] = match
|
||||||
|
|
||||||
# Get the newest results from the search
|
# Get the newest results from the search
|
||||||
mysack = yum.packageSack.ListPackageSack(matches)
|
mysack = yum.packageSack.ListPackageSack(matches)
|
||||||
for match in mysack.returnNewestByNameArch():
|
for match in mysack.returnNewestByNameArch():
|
||||||
unprocessed_pkgs[match] = None
|
|
||||||
self.tsInfo.addInstall(match)
|
self.tsInfo.addInstall(match)
|
||||||
|
|
||||||
if not self.config.has_option('default', 'quiet'):
|
if not self.config.has_option('default', 'quiet'):
|
||||||
for pkg in unprocessed_pkgs.keys():
|
self.logger.info('Found %s.%s' % (match.name, match.arch))
|
||||||
self.logger.info('Found %s.%s' % (pkg.name, pkg.arch))
|
|
||||||
|
|
||||||
for pkg in unmatched:
|
for pkg in unmatched:
|
||||||
if not pkg in matches:
|
if not pkg in matchdict.keys():
|
||||||
self.logger.warn('Could not find a match for %s' % pkg)
|
self.logger.warn('Could not find a match for %s' % pkg)
|
||||||
|
|
||||||
if len(unprocessed_pkgs) == 0:
|
if len(self.tsInfo) == 0:
|
||||||
raise yum.Errors.MiscError, 'No packages found to download.'
|
raise yum.Errors.MiscError, 'No packages found to download.'
|
||||||
|
|
||||||
while len(unprocessed_pkgs) > 0: # Our fun loop
|
moretoprocess = True
|
||||||
for pkg in unprocessed_pkgs.keys():
|
while moretoprocess: # Our fun loop
|
||||||
if not final_pkgobjs.has_key(pkg):
|
for txmbr in self.tsInfo:
|
||||||
final_pkgobjs[pkg] = None # Add the pkg to our final list
|
if not final_pkgobjs.has_key(txmbr.po):
|
||||||
deplist = self.getPackageDeps(pkg) # Get the deps of our package
|
final_pkgobjs[txmbr.po] = None # Add the pkg to our final list
|
||||||
|
self.getPackageDeps(txmbr.po) # Get the deps of our package
|
||||||
for dep in deplist: # Cycle through deps, if we don't already have it, add it.
|
else:
|
||||||
if not unprocessed_pkgs.has_key(dep) and not final_pkgobjs.has_key(dep):
|
moretoprocess = False
|
||||||
unprocessed_pkgs[dep] = None
|
|
||||||
|
|
||||||
del unprocessed_pkgs[pkg] # Clear the package out of our todo list.
|
|
||||||
|
|
||||||
self.polist = final_pkgobjs.keys()
|
self.polist = final_pkgobjs.keys()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user