[yum-commits] Branch 'yum-3_2_X' - 4 commits - yum/depsolve.py yum/rpmsack.py
James Antill
james at osuosl.org
Fri Jun 19 19:54:53 UTC 2009
yum/depsolve.py | 11 +++++++----
yum/rpmsack.py | 7 +++----
2 files changed, 10 insertions(+), 8 deletions(-)
New commits:
commit 97bae95fa05726e921a96613876cfb633b483284
Author: James Antill <james at and.org>
Date: Fri Jun 19 15:53:25 2009 -0400
Fix _old_ bug in rpmdb.returnNewestByNameArch().
It tracebacks when we have more than one result,
luckily that only happens for installonly pkgs.
Test:
yb.rpmdb.returnNewestByNameArch(('kernel', 'x86_64'))
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 2f67b65..dbf01f9 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -268,12 +268,12 @@ class RPMDBPackageSack(PackageSackBase):
(name, arch) = naTup
- allpkg = [ po.pkgtup for po in self._search(name=name, arch=arch) ]
+ allpkg = self._search(name=name, arch=arch)
if not allpkg:
raise Errors.PackageSackError, 'No Package Matching %s' % name
- return misc.newestInList(allpkg)
+ return [ po.pkgtup for po in misc.newestInList(allpkg) ]
def returnNewestByName(self, name=None):
if not name:
commit 5c7851d021d1987c96067679329ee3f1f491608d
Author: James Antill <james at and.org>
Date: Fri Jun 19 15:48:53 2009 -0400
Fix comment on _search()
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index c5a5b77..2f67b65 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -448,8 +448,7 @@ class RPMDBPackageSack(PackageSackBase):
def _search(self, name=None, epoch=None, ver=None, rel=None, arch=None):
- '''Generator that yields matching packages
- '''
+ '''List of matching packages, to zero or more of NEVRA.'''
pkgtup = (name, arch, epoch, ver, rel)
if self._tup2pkg.has_key(pkgtup):
return [self._tup2pkg[pkgtup]]
commit 332fba3e9c92abe8b62dfce29c458d43087317bc
Author: James Antill <james at and.org>
Date: Fri Jun 19 15:25:55 2009 -0400
Speed up install "font(:lang=en)", by a couple of seconds
diff --git a/yum/depsolve.py b/yum/depsolve.py
index d2bd7ad..dc9b388 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -1066,12 +1066,13 @@ class Depsolve(object):
for pkg in pkgs:
pkgresults[pkg] = 0
- if self.rpmdb.contains(pkg.name):
+
+ rpmdbpkgs = self.rpmdb.searchNevra(name=pkg.name)
+ if rpmdbpkgs:
# We only want to count things as "installed" if they are
# older than what we are comparing, because this then an update
# so we give preference. If they are newer then obsoletes/etc.
# could play a part ... this probably needs a better fix.
- rpmdbpkgs = self.rpmdb.returnPackages(patterns=[pkg.name])
newest = sorted(rpmdbpkgs)[-1]
if newest.verLT(pkg):
ipkgresults[pkg] = 0
commit b81f0b56a68fec5f4b33e28570f3613784e75a7d
Author: James Antill <james at and.org>
Date: Fri Jun 19 15:24:05 2009 -0400
Speed up install "font(:lang=en)", by a huge amount (~21 minutes)
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 81de803..d2bd7ad 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -1106,6 +1106,7 @@ class Depsolve(object):
# add the negative of the length of the name to the score
+ lpos = {}
for po in pkgs:
for nextpo in pkgs:
if po == nextpo:
@@ -1115,8 +1116,9 @@ class Depsolve(object):
# treat it like it's obsoleted. The problem here is X-1
# accidentally provides FOO, so you release X-2 without the
# provide, but X-1 is still picked over a real provider.
- lpos = self.pkgSack.returnNewestByName(po.name)
- if not lpos or po != sorted(lpos)[-1]:
+ if po.name not in lpos:
+ lpos[po.name] = self.pkgSack.returnNewestByName(po.name)[:1]
+ if not lpos[po.name] or not po.verEQ(lpos[po.name][0]):
pkgresults[po] -= 1024
obsoleted = False
More information about the Yum-commits
mailing list