[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/__init__.py

James Antill james at osuosl.org
Tue Aug 4 14:15:24 UTC 2009


 yum/__init__.py |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 00eff8e1bed358694e93a57d319f1d9d4eceecb2
Author: James Antill <james at and.org>
Date:   Mon Aug 3 18:12:21 2009 -0400

    Allow .install(pkgtup=) to fail nicely, as it does for name= and pattern=

diff --git a/yum/__init__.py b/yum/__init__.py
index bba2c86..55ec450 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2707,6 +2707,8 @@ class YumBase(depsolve.Depsolve):
                                                  ignore_case=False)
             if 'name' in kwargs:
                 pkgs = self.rpmdb.searchNevra(name=kwargs['name'])
+            if 'pkgtup' in kwargs:
+                pkgs = self.rpmdb.searchNevra(name=kwargs['pkgtup'][0])
             # Warning here does "weird" things when doing:
             # yum --disablerepo='*' install '*'
             # etc. ... see RHBZ#480402
@@ -3299,9 +3301,7 @@ class YumBase(depsolve.Depsolve):
             if isinstance(po, YumLocalPackage):
                 members = self.install(po=po)
             else:
-                members = self.install(name=item.name, arch=item.arch,
-                                       ver=item.version, release=item.release,
-                                       epoch=item.epoch)
+                members = self.install(pkgtup=item.pkgtup)
             self.conf.obsoletes = old_conf_obs
             if len(members) == 0:
                 self.tsInfo.remove(item.pkgtup)
commit 3b5782d3fde01601c6961e9f8945802ae9c47e83
Author: James Antill <james at and.org>
Date:   Mon Aug 3 18:10:03 2009 -0400

     Allow "yum reinstall *" etc. when we have "extra" packages.
    
    The big problem here is that we did:
    
    1. Find all removable pacakges matching the pattern.
    
    2. Go through and try to reinstall them.
    
    ...but the first time we failed on #2, we'd throw an exception leaving
    the rest of the pacakges from #1 in just a remove state.

diff --git a/yum/__init__.py b/yum/__init__.py
index e683860..bba2c86 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3280,7 +3280,8 @@ class YumBase(depsolve.Depsolve):
         # this is a reinstall, so if we can't reinstall exactly what we uninstalled
         # then we really shouldn't go on
         new_members = []
-        for item in tx_mbrs:
+        failed = []
+        for item in tx_mbrs[:]:
             #FIXME future - if things in the rpm transaction handling get
             # a bit finer-grained, then we should allow reinstalls of kernels
             # for now, banned and dropped.
@@ -3305,9 +3306,12 @@ class YumBase(depsolve.Depsolve):
             if len(members) == 0:
                 self.tsInfo.remove(item.pkgtup)
                 tx_mbrs.remove(item)
-                raise Errors.ReinstallInstallError, _("Problem in reinstall: no package %s matched to install") % item.po
+                failed.append(str(item.po))
+                continue
             new_members.extend(members)
 
+        if failed and not tx_mbrs:
+            raise Errors.ReinstallInstallError, _("Problem in reinstall: no package %s matched to install") % ", ".join(failed)
         tx_mbrs.extend(new_members)
         return tx_mbrs
         


More information about the Yum-commits mailing list