40 lines
1.8 KiB
Diff
40 lines
1.8 KiB
Diff
|
diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
|
||
|
index 059b748..337b32a 100644
|
||
|
--- a/src/pypungi/__init__.py
|
||
|
+++ b/src/pypungi/__init__.py
|
||
|
@@ -506,22 +506,22 @@ class Pungi(pypungi.PungiBase):
|
||
|
else:
|
||
|
# nogreedy
|
||
|
for name in searchlist:
|
||
|
- arch = None
|
||
|
- if "." in name:
|
||
|
- name, arch = name.rsplit(".", 1)
|
||
|
+ packages_by_name = {}
|
||
|
+ exactmatched, matched, unmatched = yum.packages.parsePackages(self.ayum.pkgSack.returnPackages(), [name], casematch=1)
|
||
|
+ matches = filter(self._filtersrcdebug, exactmatched + matched)
|
||
|
|
||
|
- 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:
|
||
|
+ if not matches:
|
||
|
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))
|
||
|
+ for i in matches:
|
||
|
+ packages_by_name.setdefault(i.name, []).append(i)
|
||
|
+
|
||
|
+ for i, pkg_sack in packages_by_name.iteritems():
|
||
|
+ pkg_sack = self.excludePackages(pkg_sack)
|
||
|
+ match = self.ayum._bestPackageFromList(pkg_sack)
|
||
|
+ self.ayum.tsInfo.addInstall(match)
|
||
|
+ self.logger.info('Found %s.%s' % (match.name, match.arch))
|
||
|
|
||
|
if len(self.ayum.tsInfo) == 0:
|
||
|
raise yum.Errors.MiscError, 'No packages found to download.'
|