[yum-git] yum/__init__.py yum/packages.py
James Antill
james at linux.duke.edu
Tue Feb 12 15:45:40 UTC 2008
yum/__init__.py | 2 +-
yum/packages.py | 19 ++++++++++++++++---
2 files changed, 17 insertions(+), 4 deletions(-)
New commits:
commit 73fc75b28416f4d43d6d362c9b732e72d2515406
Author: James Antill <james at and.org>
Date: Tue Feb 12 10:45:00 2008 -0500
Fix double nevra package in repo. excluding
diff --git a/yum/__init__.py b/yum/__init__.py
index 2b88c9c..2d7c1b6 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -842,7 +842,7 @@ class YumBase(depsolve.Depsolve):
pkgs = self._pkgSack.returnPackages(repoid, patterns=excludelist)
exactmatch, matched, unmatched = \
- parsePackages(pkgs, excludelist, casematch=1)
+ parsePackages(pkgs, excludelist, casematch=1, unique='repo-pkgkey')
for po in exactmatch + matched:
self.verbose_logger.debug('Excluding %s', po)
diff --git a/yum/packages.py b/yum/packages.py
index 42c3174..ebb0301 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -78,7 +78,8 @@ def buildPkgRefDict(pkgs, casematch=True):
return pkgdict
-def parsePackages(pkgs, usercommands, casematch=0):
+def parsePackages(pkgs, usercommands, casematch=0,
+ unique='repo-epoch-name-version-release-arch'):
"""matches up the user request versus a pkg list:
for installs/updates available pkgs should be the 'others list'
for removes it should be the installed list of pkgs
@@ -124,9 +125,21 @@ def parsePackages(pkgs, usercommands, casematch=0):
else:
unmatched.append(command)
- matched = misc.unique(matched)
unmatched = misc.unique(unmatched)
- exactmatch = misc.unique(exactmatch)
+ if unique == 'repo-epoch-name-version-release-arch': # pkg.__hash__
+ matched = misc.unique(matched)
+ exactmatch = misc.unique(exactmatch)
+ elif unique == 'repo-pkgkey': # So we get all pkg entries from a repo
+ def pkgunique(pkgs):
+ u = {}
+ for pkg in pkgs:
+ mark = "%s%s" % (pkg.repo.id, pkg.pkgKey)
+ u[mark] = pkg
+ return u.values()
+ matched = pkgunique(matched)
+ exactmatch = pkgunique(exactmatch)
+ else:
+ raise ValueError, "Bad value for unique: %s" % unique
return exactmatch, matched, unmatched
class FakeRepository:
More information about the Yum-cvs-commits
mailing list