[yum-git] yum/Errors.py yum/__init__.py

Seth Vidal skvidal at linux.duke.edu
Mon Mar 17 17:50:39 UTC 2008


 yum/Errors.py   |    3 +++
 yum/__init__.py |   13 +++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 4cc1380a2f1394e6a28376e66eefa0e3eb5a2e01
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Mon Mar 17 13:46:39 2008 -0400

    when doing a reinstall, if the package is one of the ones that can be
    installed multiple times, just take it out and tell the user about it.
    It will end in sadness if they do a reinstall on a kernel or a kernel-module
    so let's just tell them 'no' rather than having the whole thing explode
    in awkward ways, for now.
    
    also add reinstallError to errors

diff --git a/yum/Errors.py b/yum/Errors.py
index 67f6495..94162b9 100644
--- a/yum/Errors.py
+++ b/yum/Errors.py
@@ -70,6 +70,9 @@ class UpdateError(YumBaseError):
 class RemoveError(YumBaseError):
     pass
 
+class ReinstallError(YumBaseError):
+    pass
+
 class RepoMDError(YumBaseError):
     pass
 
diff --git a/yum/__init__.py b/yum/__init__.py
index 8d1a9bb..e736d58 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2508,16 +2508,25 @@ class YumBase(depsolve.Depsolve):
         tx_mbrs = []
         tx_mbrs.extend(self.remove(po, **kwargs))
         if not tx_mbrs:
-            raise Errors.RemoveError, _("Problem in reinstall: no package matched to remove")
+            raise Errors.ReinstallError, _("Problem in reinstall: no package matched to remove")
         templen = len(tx_mbrs)
         # 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:
+            #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.
+            if self.allowedMultipleInstalls(item.po):
+                self.tsInfo.remove(item.pkgtup)
+                msg = _("Package %s is allowed multiple installs, skipping") % item.po
+                self.verbose_logger.log(logginglevels.INFO_2, msg)
+                continue
+            
             members = self.install(name=item.name, arch=item.arch,
                            ver=item.version, release=item.release, epoch=item.epoch)
             if len(members) == 0:
-                raise Errors.RemoveError, _("Problem in reinstall: no package matched to install")
+                raise Errors.ReinstallError, _("Problem in reinstall: no package matched to install")
             new_members.extend(members)
 
         tx_mbrs.extend(new_members)            



More information about the Yum-cvs-commits mailing list