[yum-commits] 2 commits - test/simpleobsoletestests.py yum/depsolve.py

James Antill james at osuosl.org
Tue Oct 30 13:26:38 UTC 2012


 test/simpleobsoletestests.py |   61 +++++++++++++++++++++++++++++++++++++++++++
 yum/depsolve.py              |    3 ++
 2 files changed, 64 insertions(+)

New commits:
commit 7e852006ca7826955e5fb7b153ee348df1c5772f
Author: James Antill <james at and.org>
Date:   Mon Oct 29 15:08:25 2012 -0400

    Fix circular obsoletes in transaction members check. BZ 868840.

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 5e95662..a16f1f5 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -911,6 +911,9 @@ class Depsolve(object):
                             if otxmbr.output_state not in TS_INSTALL_STATES:
                                 continue
                             if otxmbr.po.obsoletedBy([txmbr.po]):
+                                if txmbr.po.obsoletedBy([otxmbr.po]):
+                                    # Have to deal with loops!
+                                    continue
                                 self.tsInfo.remove(otxmbr.pkgtup)
                                 #  We need to remove an obsoleted entry that
                                 # was maybe used to resolve something ... ?
commit f5316c7714d33d475698b5065fc248eeca1b7541
Author: James Antill <james at and.org>
Date:   Mon Oct 29 15:07:14 2012 -0400

    Add circular obsoletes tests for transaction members. BZ 868840

diff --git a/test/simpleobsoletestests.py b/test/simpleobsoletestests.py
index 55e6f14..e9b2c09 100644
--- a/test/simpleobsoletestests.py
+++ b/test/simpleobsoletestests.py
@@ -644,6 +644,67 @@ class SimpleObsoletesTests(OperationsTests):
         # In theory don't need to upgrade oc1 => oc2
         self.assertResult((oc2, osl2, osll2))
 
+    def testCircObs1(self):
+        c1 = FakePackage('test-ccc', '0.1', '1')
+        c2 = FakePackage('test-ccc', '0.2', '2')
+        c2.addObsoletes('test-ddd', None, (None, None, None))
+
+        d1 = FakePackage('test-ddd', '0.1', '1')
+        d2 = FakePackage('test-ddd', '0.2', '2')
+        d2.addObsoletes('test-ccc', None, (None, None, None))
+
+        res, msg = self.runOperation(['upgrade'],
+                                     [c1, d1],
+                                     [c1, d1, c2, d2])
+
+        self.assertResult((c2, d2))
+
+    def testCircObs2(self):
+        c1 = FakePackage('test-ccc', '0.1', '1')
+        c2 = FakePackage('test-ccc', '0.2', '2')
+        c2.addObsoletes('test-ddd', None, (None, None, None))
+
+        d1 = FakePackage('test-ddd', '0.1', '1')
+        d2 = FakePackage('test-ddd', '0.2', '2')
+        d2.addObsoletes('test-ccc', None, (None, None, None))
+
+        res, msg = self.runOperation(['upgrade', 'test-ccc', 'test-ddd'],
+                                     [c1, d1],
+                                     [c1, d1, c2, d2])
+
+        self.assertResult((c2, d2))
+
+    def testCircObs3(self):
+        c1 = FakePackage('test-ccc', '0.1', '1')
+        c2 = FakePackage('test-ccc', '0.2', '2')
+        c2.addObsoletes('test-ddd', None, (None, None, None))
+
+        d1 = FakePackage('test-ddd', '0.1', '1')
+        d2 = FakePackage('test-ddd', '0.2', '2')
+        d2.addObsoletes('test-ccc', None, (None, None, None))
+
+        res, msg = self.runOperation(['upgrade', 'test-ccc'],
+                                     [c1, d1],
+                                     [c1, d1, c2, d2])
+
+        # Just c2 is fine too, although less likely what the user wants
+        self.assertResult((c2,d2))
+
+    def testCircObs4(self):
+        c1 = FakePackage('test-ccc', '0.1', '1')
+        c2 = FakePackage('test-ccc', '0.2', '2')
+        c2.addObsoletes('test-ddd', None, (None, None, None))
+
+        d1 = FakePackage('test-ddd', '0.1', '1')
+        d2 = FakePackage('test-ddd', '0.2', '2')
+        d2.addObsoletes('test-ccc', None, (None, None, None))
+
+        res, msg = self.runOperation(['upgrade', 'test-ddd'],
+                                     [c1, d1],
+                                     [c1, d1, c2, d2])
+
+        # Just d2 is fine too, although less likely what the user wants
+        self.assertResult((c2,d2))
 
 
 class GitMetapackageObsoletesTests(OperationsTests):


More information about the Yum-commits mailing list