[yum-commits] Branch 'yum-3_2_X' - 3 commits - test/simpleupdatetests.py test/testbase.py yum/depsolve.py
James Antill
james at osuosl.org
Mon Feb 9 20:54:50 UTC 2009
test/simpleupdatetests.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++
test/testbase.py | 3 +-
yum/depsolve.py | 9 ++++++-
3 files changed, 63 insertions(+), 2 deletions(-)
New commits:
commit b5bcc39f50bf7fa1d510a01182ee69b3366511cc
Author: James Antill <james at and.org>
Date: Mon Feb 9 15:54:03 2009 -0500
Fix for BZ 484739, process obsoletes on older pkgs when newer is installed
diff --git a/yum/depsolve.py b/yum/depsolve.py
index c375fe0..97f2b3f 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -1040,7 +1040,14 @@ class Depsolve(object):
for pkg in pkgs:
pkgresults[pkg] = 0
if self.rpmdb.contains(pkg.name):
- ipkgresults[pkg] = 0
+ # 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
# This is probably only for "renames". What happens is that pkgA-1 gets
# obsoleted by pkgB but pkgB requires pkgA-2, now _if_ the pkgA txmbr
commit 9a7bf75e4620132fe6b3ea23ce6333263b297264
Author: James Antill <james at and.org>
Date: Mon Feb 9 15:35:42 2009 -0500
Test cases for BZ 484739
diff --git a/test/simpleupdatetests.py b/test/simpleupdatetests.py
index 0a84f3f..d52cc9d 100644
--- a/test/simpleupdatetests.py
+++ b/test/simpleupdatetests.py
@@ -630,3 +630,56 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='err', msg)
# self.assert_(res=='ok', msg)
# self.assertResult((p12,pv12))
+
+ def testInstallFilenamePkgSplit1(self):
+ pi11 = FakePackage('phoo', '1', '1', '0', 'i386')
+ pi11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
+ pr11 = FakePackage('phoo', '1', '1', '0', 'i386')
+ pr11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
+ p12 = FakePackage('phoo', '1', '2', '0', 'i386')
+ py12 = FakePackage('phoo-y', '1', '2', '0', 'i386')
+ py12.addProvides('/path/to/phooy', 'EQ', ('0', '1', '2'))
+
+
+ res, msg = self.runOperation(['update', '/path/to/phooy'],
+ [pi11],
+ [pr11,p12, py12])
+ self.assert_(res=='ok', msg)
+ # FIXME: We'd really like it to be:
+ # self.assertResult((p12,py12))
+ # ...but there is no info. you can work this out with.
+ self.assertResult((p12,))
+
+ def testInstallFilenamePkgSplit2(self):
+ pi11 = FakePackage('phoo', '1', '1', '0', 'i386')
+ pi11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
+ pr11 = FakePackage('phoo', '1', '1', '0', 'i386')
+ pr11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
+ p12 = FakePackage('phoo', '1', '2', '0', 'i386')
+ p12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
+ py12 = FakePackage('phoo-y', '1', '2', '0', 'i386')
+ py12.addProvides('/path/to/phooy', 'EQ', ('0', '1', '2'))
+ py12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
+
+ res, msg = self.runOperation(['update', '/path/to/phooy'],
+ [pi11],
+ [pr11,p12, py12])
+ self.assert_(res=='ok', msg)
+ self.assertResult((p12,py12))
+
+ def testInstallFilenamePkgSplit3(self):
+ p11 = FakePackage('phoo', '1', '1', '0', 'i386')
+ p11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
+ pi12 = FakePackage('phoo', '1', '2', '0', 'i386')
+ pi12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
+ pr12 = FakePackage('phoo', '1', '2', '0', 'i386')
+ pr12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
+ py12 = FakePackage('phoo-y', '1', '2', '0', 'i386')
+ py12.addProvides('/path/to/phooy', 'EQ', ('0', '1', '2'))
+ py12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
+
+ res, msg = self.runOperation(['install', '/path/to/phooy'],
+ [pi12],
+ [p11, pr12, py12])
+ self.assert_(res=='ok', msg)
+ self.assertResult((pi12,py12))
commit 3f4a845846d309e0ca8ddfc5cfdbad4700c09ef6
Author: James Antill <james at and.org>
Date: Mon Feb 9 15:31:05 2009 -0500
Fixes for testbase classes
diff --git a/test/testbase.py b/test/testbase.py
index 9487441..9cab5f9 100644
--- a/test/testbase.py
+++ b/test/testbase.py
@@ -42,6 +42,7 @@ class FakeConf(object):
self.multilib_policy = 'best'
self.persistdir = '/should-not-exist-bad-test!'
self.showdupesfromrepos = False
+ self.uid = 0
class FakeRepo(object):
@@ -324,7 +325,7 @@ class OperationsTests(_DepsolveTestsBase):
requirements from.
"""
depsolver = YumBaseCli()
- self.rpmdb = depsolver.rpmdb = packageSack.PackageSack()
+ self.rpmdb = depsolver.rpmdb = FakeRpmDb()
self.xsack = depsolver._pkgSack = packageSack.PackageSack()
self.repo = depsolver.repo = FakeRepo("installed")
depsolver.conf = FakeConf()
More information about the Yum-commits
mailing list