Greedy matching should only matter for dependencies, not for explicitly specified packages.
Signed-off-by: Bill Nottingham <notting(a)redhat.com>
---
src/pypungi/__init__.py | 57 +++++++++++++++--------------------------------
1 file changed, 18 insertions(+), 39 deletions(-)
diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
index 8366434..3cfc05b 100644
--- a/src/pypungi/__init__.py
+++ b/src/pypungi/__init__.py
@@ -483,45 +483,24 @@ class Pungi(pypungi.PungiBase):
# Make the search list unique
searchlist = yum.misc.unique(searchlist)
- if self.config.getboolean('pungi', 'alldeps'):
- # greedy
- # Search repos for things in our searchlist, supports globs
- (exactmatched, matched, unmatched) = yum.packages.parsePackages(self.ayum.pkgSack.returnPackages(), searchlist, casematch=1)
- matches = filter(self._filtersrcdebug, exactmatched + matched)
- matches = self.excludePackages(matches)
-
- # Populate a dict of package objects to their names
- for match in matches:
- matchdict[match.name] = match
-
- # Get the newest results from the search
- mysack = yum.packageSack.ListPackageSack(matches)
- for match in mysack.returnNewestByNameArch():
- self.ayum.tsInfo.addInstall(match)
- self.logger.info('Found %s.%s' % (match.name, match.arch))
-
- for pkg in unmatched:
- if not pkg in matchdict.keys():
- self.logger.warn('Could not find a match for %s in any configured repo' % pkg)
- else:
- # nogreedy
- for name in searchlist:
- arch = None
- if "." in name:
- name, arch = name.rsplit(".", 1)
-
- pkg_sack = self.ayum.pkgSack.searchNevra(name=name, arch=arch)
- # filter sources out of the package sack
- pkg_sack = [ i for i in pkg_sack if i.arch not in ("src", "nosrc") ]
- pkg_sack = self.excludePackages(pkg_sack)
-
- match = self.ayum._bestPackageFromList(pkg_sack)
- if not match:
- self.logger.warn('Could not find a match for %s in any configured repo' % name)
- continue
-
- self.ayum.tsInfo.addInstall(match)
- self.logger.info('Found %s.%s' % (match.name, match.arch))
+ # Search repos for things in our searchlist, supports globs
+ (exactmatched, matched, unmatched) = yum.packages.parsePackages(self.ayum.pkgSack.returnPackages(), searchlist, casematch=1)
+ matches = filter(self._filtersrcdebug, exactmatched + matched)
+ matches = self.excludePackages(matches)
+
+ # Populate a dict of package objects to their names
+ for match in matches:
+ matchdict[match.name] = match
+
+ # Get the newest results from the search
+ mysack = yum.packageSack.ListPackageSack(matches)
+ for match in mysack.returnNewestByNameArch():
+ self.ayum.tsInfo.addInstall(match)
+ self.logger.info('Found %s.%s' % (match.name, match.arch))
+
+ for pkg in unmatched:
+ if not pkg in matchdict.keys():
+ self.logger.warn('Could not find a match for %s in any configured repo' % pkg)
if len(self.ayum.tsInfo) == 0:
raise yum.Errors.MiscError, 'No packages found to download.'
--
1.7.10.4