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

skvidal at osuosl.org skvidal at osuosl.org
Wed Oct 20 16:07:03 UTC 2010


 test/simpleobsoletestests.py |   10 ++--------
 yum/depsolve.py              |   20 +++++++++++++++++++-
 yum/transactioninfo.py       |   20 ++++++++++++++++++--
 3 files changed, 39 insertions(+), 11 deletions(-)

New commits:
commit 15dbcdd26044c74a17729973f73fc632195fcacb
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Wed Oct 20 12:05:34 2010 -0400

    make sure we mark the other txmbr as obsoleting

diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 587103f..4c59301 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -667,7 +667,8 @@ class TransactionData:
             for pkg in self.rpmdb.searchNevra(name=obs_n):
                 if pkg.obsoletedBy([txmbr.po]):
                     self.addObsoleted(pkg, txmbr.po)
-                    
+                    txmbr.output_state = TS_OBSOLETING
+                    txmbr.po.state = TS_OBSOLETING
 
 
 class ConditionalTransactionData(TransactionData):
commit 7df238bc9686562b194dee6af597aa6f97a1363d
Merge: 9935466... 24180ff...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Oct 19 16:53:50 2010 -0400

    Merge branch 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum into yum-3_2_X
    
    * 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum:
      Avoid errors with empty completion words, BZ 644265.

commit 9935466388d82a53bd429f645a4268d28a161c10
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Oct 19 16:48:33 2010 -0400

    fix the unittests to remove the FIXMEs b/c now they are fixed.

diff --git a/test/simpleobsoletestests.py b/test/simpleobsoletestests.py
index dfaa7e5..97a9923 100644
--- a/test/simpleobsoletestests.py
+++ b/test/simpleobsoletestests.py
@@ -560,10 +560,7 @@ class SimpleObsoletesTests(OperationsTests):
         res, msg = self.runOperation(['install', 'dapl-2.0.15'], rps, aps)
 
         self.assert_(res=='ok', msg)
-        # This will almost certainly fail, but it's pretty weird:
-        self.assertResult((all['arp3'], all['aoop1'], all['aoop2']))
-        # FIXME: Optimally we'd get:
-        # self.assertResult((all['arp3'], all['arp4']))
+        self.assertResult((all['arp3'], all['arp4']))
     def testRLDaplMessWeirdUp1(self):
         rps, aps, ret, all = self._helperRLDaplMess()
         res, msg = self.runOperation(['update', 'dapl-1.2.1.1-7'], rps, aps)
@@ -582,10 +579,7 @@ class SimpleObsoletesTests(OperationsTests):
         res, msg = self.runOperation(['update', 'dapl-2.0.15'], rps, aps)
 
         self.assert_(res=='ok', msg)
-        # This will almost certainly fail, but it's pretty weird:
-        self.assertResult((all['arp3'], all['aoop1'], all['aoop2']))
-        # FIXME: Optimally we'd get:
-        # self.assertResult((all['arp3'], all['arp4']))
+        self.assertResult((all['arp3'], all['arp4']))
 
     def testRLDaplFixUpdateNotInstall(self):
         rps, aps, ret, all = self._helperRLDaplMess()
commit c0124699e38151144ef72ab1be9d8c42510ce375
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Oct 19 16:47:20 2010 -0400

    when depsolving - if we have a dep from an installed pkg.
    Check to see if the thing it requires is being updated or obsoleted.
    If it is being updated then try to update the requiring Pkg w/o obsoletes.
    
    this is only to fix a couple of oddball cases where pulling in the obsoleters is....
    less likely to be the correct thing to do.

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 4fcc6f3..cba0fc5 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -376,7 +376,24 @@ class Depsolve(object):
         self.verbose_logger.log(logginglevels.DEBUG_2, _('Mode for pkg providing %s: %s'), 
             niceformatneed, needmode)
 
-        if needmode in ['ud', 'od']: # the thing it needs is being updated or obsoleted away 
+        if needmode in ['ud']: # the thing it needs is being updated or obsoleted away 
+            # try to update the requiring package in hopes that all this problem goes away :(
+            self.verbose_logger.log(logginglevels.DEBUG_2, _('Trying to update %s to resolve dep'), requiringPo)
+            # if the required pkg was updated, not obsoleted, then try to
+            # only update the requiring po
+            origobs = self.conf.obsoletes
+            self.conf.obsoletes = 0
+            txmbrs = self.update(po=requiringPo, requiringPo=requiringPo)
+            self.conf.obsoletes = origobs
+            if not txmbrs:
+                txmbrs = self.update(po=requiringPo, requiringPo=requiringPo)
+                if not txmbrs:
+                    msg = self._err_missing_requires(requiringPo, requirement)
+                    self.verbose_logger.log(logginglevels.DEBUG_2, _('No update paths found for %s. Failure!'), requiringPo)
+                    return self._requiringFromTransaction(requiringPo, requirement, errorlist)
+            checkdeps = 1
+
+        if needmode in ['od']: # the thing it needs is being updated or obsoleted away 
             # try to update the requiring package in hopes that all this problem goes away :(
             self.verbose_logger.log(logginglevels.DEBUG_2, _('Trying to update %s to resolve dep'), requiringPo)
             txmbrs = self.update(po=requiringPo, requiringPo=requiringPo)
@@ -385,6 +402,7 @@ class Depsolve(object):
                 self.verbose_logger.log(logginglevels.DEBUG_2, _('No update paths found for %s. Failure!'), requiringPo)
                 return self._requiringFromTransaction(requiringPo, requirement, errorlist)
             checkdeps = 1
+
             
         if needmode in ['e']:
             self.verbose_logger.log(logginglevels.DEBUG_2, _('TSINFO: %s package requiring %s marked as erase'),
commit 90b3a34dec2a8d7b6e7fed0ce752d9566992d706
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Oct 19 16:44:39 2010 -0400

    make obsoletes a little more correct vis-a-vis rpm
    
    when we add pkgs to be updated or installed (and they are not TrueInstalls)
    then go ahead and look through them and add any pkgs that might be Obsoleted by them
    when rpm runs the transaction. Since rpm will run it whether or not we list it when
    it comes to obsoletes
    
    also add a counter any time we add or remove a pkg from the tsInfo so we can always know of state
    change based on that

diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 83b15db..587103f 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -83,7 +83,7 @@ class TransactionData:
         self.debug = 0
         self.changed = False
         self.installonlypkgs = []
-        
+        self.state_counter = 0
         self.conditionals = {} # key = pkgname, val = list of pos to add
 
         self.rpmdb = None
@@ -266,6 +266,7 @@ class TransactionData:
         self.pkgdict[txmember.pkgtup].append(txmember)
         self._namedict.setdefault(txmember.name, []).append(txmember)
         self.changed = True
+        self.state_counter += 1
         if self._isLocalPackage(txmember):
             self.localSack.addPackage(txmember.po)
         elif isinstance(txmember.po, YumAvailablePackageSqlite):
@@ -306,6 +307,7 @@ class TransactionData:
         if not self._namedict[pkgtup[0]]:
             del self._namedict[pkgtup[0]]
         self.changed = True        
+        self.state_counter += 1
     
     def exists(self, pkgtup):
         """tells if the pkg is in the class"""
@@ -419,7 +421,8 @@ class TransactionData:
 
         if self.rpmdb.contains(po=txmbr.po):
             txmbr.reinstall = True
-
+        
+        self.findObsoletedByThisMember(txmbr)
         self.add(txmbr)
         return txmbr
 
@@ -470,6 +473,7 @@ class TransactionData:
             txmbr.updates.append(oldpo)
             
         self.add(txmbr)
+        self.findObsoletedByThisMember(txmbr)
         return txmbr
 
     def addDowngrade(self, po, oldpo):
@@ -654,6 +658,17 @@ class TransactionData:
         self.rpmdb.transactionCachePackageChecksums(pkg_checksum_tups)
 
         return main
+    
+    def findObsoletedByThisMember(self, txmbr):
+        """addObsoleted() pkgs for anything that this txmbr will obsolete"""
+        # this is mostly to keep us in-line with what will ACTUALLY happen
+        # when rpm hits the obsoletes, whether we added them or not
+        for obs_n in txmbr.po.obsoletes_names:
+            for pkg in self.rpmdb.searchNevra(name=obs_n):
+                if pkg.obsoletedBy([txmbr.po]):
+                    self.addObsoleted(pkg, txmbr.po)
+                    
+
 
 class ConditionalTransactionData(TransactionData):
     """A transaction data implementing conditional package addition"""


More information about the Yum-commits mailing list