[Yum-devel] [PATCH] Pass the packages that failed to reinstall, fixes provides/files. BZ 612201.

seth vidal skvidal at fedoraproject.org
Wed Jul 7 16:08:43 UTC 2010


On Wed, 2010-07-07 at 11:54 -0400, James Antill wrote:
> ---
>  cli.py          |   18 +++++++++---------
>  yum/Errors.py   |    4 +++-
>  yum/__init__.py |    4 +++-
>  3 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/cli.py b/cli.py
> index fc4ee1c..9542b7a 100644
> --- a/cli.py
> +++ b/cli.py
> @@ -833,15 +833,15 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
>              except yum.Errors.ReinstallRemoveError:
>                  self._checkMaybeYouMeant(arg, always_output=False)
>              except yum.Errors.ReinstallInstallError, e:
> -                ipkg = self.rpmdb.returnPackages(patterns=[arg])[0]
> -                xmsg = ''
> -                if 'from_repo' in ipkg.yumdb_info:
> -                    xmsg = ipkg.yumdb_info.from_repo
> -                    xmsg = _(' (from %s)') % xmsg
> -                self.verbose_logger.log(yum.logginglevels.INFO_2,
> -                                        _('Installed package %s%s%s%s not available.'),
> -                                        self.term.MODE['bold'], ipkg,
> -                                        self.term.MODE['normal'], xmsg)
> +                for ipkg in e.failed_pkgs:
> +                    xmsg = ''
> +                    if 'from_repo' in ipkg.yumdb_info:
> +                        xmsg = ipkg.yumdb_info.from_repo
> +                        xmsg = _(' (from %s)') % xmsg
> +                    msg = _('Installed package %s%s%s%s not available.')
> +                    self.verbose_logger.log(yum.logginglevels.INFO_2, msg,
> +                                            self.term.MODE['bold'], ipkg,
> +                                            self.term.MODE['normal'], xmsg)
>              except yum.Errors.ReinstallError, e:
>                  assert False, "Shouldn't happen, but just in case"
>                  self.verbose_logger.log(yum.logginglevels.INFO_2, e)
> diff --git a/yum/Errors.py b/yum/Errors.py
> index a3a12c5..211625b 100644
> --- a/yum/Errors.py
> +++ b/yum/Errors.py
> @@ -90,7 +90,9 @@ class ReinstallRemoveError(ReinstallError):
>      pass
>  
>  class ReinstallInstallError(ReinstallError):
> -    pass
> +    def __init__(self, value=None, failed_pkgs=[]):
> +        ReinstallError.__init__(self, value)
> +        self.failed_pkgs = failed_pkgs
>  
>  class DowngradeError(YumBaseError):
>      pass
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 5dfea8b..c7d3a42 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -3863,6 +3863,7 @@ class YumBase(depsolve.Depsolve):
>          # then we really shouldn't go on
>          new_members = []
>          failed = []
> +        failed_pkgs = []
>          for item in tx_mbrs[:]:
>              #  Make sure obsoletes processing is off, so we can reinstall()
>              # pkgs that are obsolete.
> @@ -3877,11 +3878,12 @@ class YumBase(depsolve.Depsolve):
>                  self.tsInfo.remove(item.pkgtup)
>                  tx_mbrs.remove(item)
>                  failed.append(str(item.po))
> +                failed_pkgs.append(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)
> +            raise Errors.ReinstallInstallError(_("Problem in reinstall: no package %s matched to install") % ", ".join(failed), failed_pkgs=failed_pkgs)
>          tx_mbrs.extend(new_members)
>          return tx_mbrs
>          

ACK

-sv




More information about the Yum-devel mailing list