[Yum-devel] [PATCH] Fix for obsoleting pkgs. we are trying to install

Seth Vidal skvidal at fedoraproject.org
Tue May 18 20:32:54 UTC 2010



On Tue, 18 May 2010, James Antill wrote:

> ---
> yum/__init__.py |   13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 612b6ab..f5f2b51 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -2882,7 +2882,18 @@ class YumBase(depsolve.Depsolve):
>             we should install instead. Or None if there isn't one. """
>         thispkgobsdict = self.up.checkForObsolete([po.pkgtup])
>         if po.pkgtup in thispkgobsdict:
> -            obsoleting = thispkgobsdict[po.pkgtup][0]
> +            obsoleting  = thispkgobsdict[po.pkgtup]
> +            oobsoleting = []
> +            # We want to keep the arch. of the obsoleted pkg. if possible.
> +            for opkgtup in obsoleting:
> +                if not canCoinstall(po.arch, opkgtup[1]):
> +                    oobsoleting.append(opkgtup)
> +            if oobsoleting:
> +                obsoleting = oobsoleting
> +            # NOTE: if we move from noarch => multilib. then the ordering
> +            #       here seems to always prefer i386 over x86_64 which is wrong.
> +            #       Need to sort by arch?
> +            obsoleting = obsoleting[0]
>             obsoleting_pkg = self.getPackageObject(obsoleting)
>             return obsoleting_pkg
>         return None


So it ends up looking something like compare_providers() but for 
obsoleters.

for each obsoleter you would sort them by:
- name just for the hell of it
- if more than one with the same name remains sort by:
    - archdistance from the obsoleted pkg's arch
    - archdistance from the system arch.

one minor note. Does the obsoleted pkg end up marking both of them or not?

ie:

installed: foo.i686 and foo.x86_64
available: bar.i686 and bar.x86_64

both bars obsolete 'foo' - so rpm will happily have EITHER bar remove both 
foo pkgs.

so we need to make sure both bars mark as replacing BOTH foos b/c that's 
what is ACTUALLY going to happen when the transaction runs and that will 
help us get things right when that does happen.

-sv



More information about the Yum-devel mailing list