[yum-commits] Branch 'yum-3_2_X' - 4 commits - test/depsolvetests.py test/simpleobsoletestests.py yum/depsolve.py yum/transactioninfo.py

James Antill james at osuosl.org
Fri Jan 2 21:37:30 UTC 2009


 test/depsolvetests.py        |    2 -
 test/simpleobsoletestests.py |   72 +++++++++++++++++++++++++++++++++++++++++++
 yum/depsolve.py              |   13 +++++++
 yum/transactioninfo.py       |    8 ++++
 4 files changed, 93 insertions(+), 2 deletions(-)

New commits:
commit 887b8fd76a43cc28785af12adce107d622d3bae8
Author: James Antill <james at and.org>
Date:   Fri Jan 2 16:36:54 2009 -0500

    If a provider is installed, prefer it (adds huge comment), fixes BZ 472756

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 4e1b637..97d6b29 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -1030,9 +1030,22 @@ class Depsolve(object):
             return x
             
         pkgresults = {}
+        ipkgresults = {}
 
         for pkg in pkgs:
             pkgresults[pkg] = 0
+            if self.rpmdb.contains(pkg.name):
+                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
+        # gets processed before pkgB then we'll process the "checkRemove" of
+        # pkgA ... so any deps. on pkgA-1 will look for a new provider, one of
+        # which is pkgA-2 in that case we want to choose that pkg over any
+        # others. This works for multiple cases too, but who'd do that right?:)
+        if ipkgresults:
+            pkgresults = ipkgresults
+            pkgs = ipkgresults.keys()
             
         # go through each pkg and compare to others
         # if it is same skip it
commit e584cfb83be874c5373c59c89efb1f7ac1c26ffb
Author: James Antill <james at and.org>
Date:   Fri Jan 2 16:30:12 2009 -0500

     Sort the _unresolvedMembers set as we turn it into a list, because just
    turning it into a list makes it different on .i386 and .x86_64 which is
    _very_ confusing.
     Add some comments for the insanity/weirdness.

diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 0a896d1..d5cce8b 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -94,8 +94,10 @@ class TransactionData:
             returnlist.extend(self.pkgdict[pkgtup])
         return returnlist
             
+    # The order we resolve things in _matters_, so for sanity sort the list
+    # otherwise .i386 can be different to .x86_64 etc.
     def getUnresolvedMembers(self):
-        return list(self._unresolvedMembers)
+        return list(sorted(self._unresolvedMembers))
 
     def markAsResolved(self, txmbr):
         self._unresolvedMembers.discard(txmbr)
@@ -154,6 +156,10 @@ class TransactionData:
 
     def _isLocalPackage(self, txmember):
         # Is this the right criteria?
+        # FIXME: This is kinda weird, we really want all local pkgs to be in a
+        # special pkgsack before this point ... so that "yum up ./*.rpm" works.
+        #  Also FakePackage() sets it off ... which is confusing and not what
+        # happens IRL.
         return txmember.ts_state in ('u', 'i') and not isinstance(txmember.po, (YumInstalledPackage, YumAvailablePackageSqlite))
 
     def _allowedMultipleInstalls(self, po):
commit 061899346489167be9375bde8e500f08dc0aeb80
Author: James Antill <james at and.org>
Date:   Fri Jan 2 16:26:28 2009 -0500

    Add tests to show the hard to find postfix problem, bug BZ 472756

diff --git a/test/simpleobsoletestests.py b/test/simpleobsoletestests.py
index 035970c..3c115b3 100644
--- a/test/simpleobsoletestests.py
+++ b/test/simpleobsoletestests.py
@@ -329,6 +329,78 @@ class SimpleObsoletesTests(OperationsTests):
         self.assert_(res=='ok', msg)
         self.assertResult((okern1,okern2,nkern,))
 
+    def testIncluderObs1(self):
+        #  We use an obsolete to include a new package Y for people with an
+        # installed pkg X. X satisfies deps. but isn't the normal best provider
+        # ... traditionally we've included the other dep. _as well_.
+        #  The "main" offender has been postfix, which brings in exim.
+        pfix1      = FakePackage('postfix',      '1', '1', '0', 'noarch')
+        pfix1.addProvides('/usr/bin/sendmail')
+        pfix2      = FakePackage('postfix',      '1', '2', '0', 'noarch')
+        pfix2.addProvides('/usr/bin/sendmail')
+        pnewfix    = FakePackage('postfix-blah', '1', '2', '0', 'noarch')
+        pnewfix.addObsoletes('postfix', 'LT', ('0', '1', '2'))
+        pnewfix.addRequires('postfix', 'EQ', ('0', '1', '2'))
+
+        dep        = FakePackage('foo', '1', '1', '0', 'noarch')
+        dep.addRequires('/usr/bin/sendmail')
+
+        exim       = FakePackage('exim', '1', '1', '0', 'noarch')
+        exim.addProvides('/usr/bin/sendmail')
+
+        res, msg = self.runOperation(['update', 'postfix'],
+                                     [pfix1, dep], [exim, pnewfix, pfix2, dep])
+        self.assert_(res=='ok', msg)
+        self.assertResult((dep, pfix2, pnewfix))
+
+    def testIncluderObs2(self):
+        #  We use an obsolete to include a new package Y for people with an
+        # installed pkg X. X satisfies deps. but isn't the normal best provider
+        # ... traditionally we've included the other dep. _as well_.
+        #  The "main" offender has been postfix, which brings in exim.
+        dep        = FakePackage('foo', '1', '1', '0', 'noarch')
+        dep.addRequires('/usr/bin/sendmail')
+
+        pfix1      = FakePackage('postfix',      '1', '1', '0', 'noarch')
+        pfix1.addProvides('/usr/bin/sendmail')
+        pfix2      = FakePackage('postfix',      '1', '2', '0', 'noarch')
+        pfix2.addProvides('/usr/bin/sendmail')
+        pnewfix    = FakePackage('postfix-blah', '1', '2', '0', 'noarch')
+        pnewfix.addObsoletes('postfix', 'LT', ('0', '1', '2'))
+        pnewfix.addRequires('postfix', 'EQ', ('0', '1', '2'))
+
+        exim       = FakePackage('exim', '1', '1', '0', 'noarch')
+        exim.addProvides('/usr/bin/sendmail')
+
+        res, msg = self.runOperation(['update', 'postfix'],
+                                     [dep, pfix1], [dep, pfix2, pnewfix, exim])
+        self.assert_(res=='ok', msg)
+        self.assertResult((dep, pfix2, pnewfix))
+
+    def testIncluderObs3(self):
+        #  We use an obsolete to include a new package Y for people with an
+        # installed pkg X. X satisfies deps. but isn't the normal best provider
+        # ... traditionally we've included the other dep. _as well_.
+        #  The "main" offender has been postfix, which brings in exim.
+        dep        = FakePackage('foo', '1', '1', '0', 'noarch')
+        dep.addRequires('/usr/bin/sendmail')
+
+        pfix1      = FakePackage('postfix',      '1', '1', '0', 'noarch')
+        pfix1.addProvides('/usr/bin/sendmail')
+        pfix2      = FakePackage('postfix',      '1', '2', '0', 'noarch')
+        pfix2.addProvides('/usr/bin/sendmail')
+        pnewfix    = FakePackage('postfix-blah', '1', '2', '0', 'noarch')
+        pnewfix.addObsoletes('postfix', 'LT', ('0', '1', '2'))
+        pnewfix.addRequires('postfix', 'EQ', ('0', '1', '2'))
+
+        exim       = FakePackage('exim', '1', '1', '0', 'noarch')
+        exim.addProvides('/usr/bin/sendmail')
+
+        res, msg = self.runOperation(['install', 'postfix-blah'],
+                                     [dep, pfix1], [dep, pfix2, pnewfix, exim])
+        self.assert_(res=='ok', msg)
+        self.assertResult((dep, pfix2, pnewfix))
+
 
 class GitMetapackageObsoletesTests(OperationsTests):
 
commit 5001f653100cb45a33b442cc827cf048da3c5518
Author: James Antill <james at and.org>
Date:   Fri Jan 2 13:23:41 2009 -0500

    Remove temp. change to test obs. processing (not added, so now broken)

diff --git a/test/depsolvetests.py b/test/depsolvetests.py
index 05e189c..51b91e5 100644
--- a/test/depsolvetests.py
+++ b/test/depsolvetests.py
@@ -1174,6 +1174,6 @@ class DepsolveTests(DepsolveTests):
 
         self.tsInfo.addUpdate(apo2, oldpo=rpo2)
 
-        self.assertEquals('ok', *self.resolveCode(obs=True))
+        self.assertEquals('ok', *self.resolveCode())
         self.assertResult((apo1, apo2))
 


More information about the Yum-commits mailing list