[Yum-devel] [PATCH 1/2] make sure obsoletes are looked up for localinstall/updated pkgs this handles the cases where the localpkg is a proper update AND an obsolete for a different installed pkg.

James Antill james at fedoraproject.org
Tue Aug 11 21:14:51 UTC 2009


On Tue, 2009-08-11 at 16:59 -0400, Seth Vidal wrote:
> ---
>  yum/__init__.py |   26 ++++++++++++++++++++------
>  1 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 9930c08..2585901 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -2586,10 +2586,18 @@ class YumBase(depsolve.Depsolve):
>  
>      def _find_obsoletees(self, po):
>          """ Return the pkgs. that are obsoleted by the po we pass in. """
> -        for (obstup, inst_tup) in self.up.getObsoletersTuples(name=po.name):
> -            if po.pkgtup == obstup:
> -                installed_pkg =  self.rpmdb.searchPkgTuple(inst_tup)[0]
> -                yield installed_pkg
> +        if not isinstance(po, YumLocalPackage):
> +            for (obstup, inst_tup) in self.up.getObsoletersTuples(name=po.name):
> +                if po.pkgtup == obstup:
> +                    installed_pkg =  self.rpmdb.searchPkgTuple(inst_tup)[0]
> +                    yield installed_pkg
> +        else:
> +            for (obs_n, obs_f, (obs_e, obs_v, obs_r)) in po.obsoletes:
> +                for pkg in self.rpmdb.searchNevra(name=obs_n):
> +                    installedtup = (pkg.name, 'EQ', (pkg.epoch, 
> +                                   pkg.ver, pkg.release))
> +                    if po.inPrcoRange('obsoletes', installedtup):
> +                        yield pkg


 I agree this "works", however the problem is that we rely on the
obsoletes data which is built up before we do anything based on looking
at just what is in the repos. So if we have local pkgs:

pkg-new-A
pkgA

...and pkg-new-A obs pkgA, then doing either of:

yum install pkgA.rpm pkg-new-A.rpm
yum install pkg-new-A.rpm pkgA.rpm

...I think we screw it up.
 At worst I think we need a big comment in here, one better would be to
check txmbr's as well as rpmdb.searchNevra() ... or the best case we
could add the obsoletes data to self.up as we load the LocalPackage().
 Of course no user is ever going to do any of the above commands,
hahaha, so it's nitpicky.

>      def _add_prob_flags(self, *flags):
>          """ Add all of the passed flags to the tsInfo.probFilterFlags array. """
> @@ -3139,7 +3147,6 @@ class YumBase(depsolve.Depsolve):
>          # append it to self.localPackages
>          # check if it can be installed or updated based on nevra versus rpmdb
>          # don't import the repos until we absolutely need them for depsolving
> -
>          tx_return = []
>          installpkgs = []
>          updatepkgs = []
> @@ -3222,7 +3229,14 @@ class YumBase(depsolve.Depsolve):
>          for po in donothingpkgs:
>              self.verbose_logger.log(logginglevels.INFO_2,
>                  _('%s: does not update installed package.'), po.localpath)
> -
> +        
> +        for txmbr in tx_return:
> +            if txmbr.po.obsoletes:
> +                for obs_pkg in self._find_obsoletees(txmbr.po):
> +                    self.tsInfo.addObsoleted(obs_pkg, txmbr.po)
> +                    txmbr.obsoletes.append(obs_pkg)
> +                    self.tsInfo.addObsoleting(txmbr.po,obs_pkg)
> +                
>          return tx_return

 This is the bottom of installLocal(), and I assume it works ... but did
you try doing what reinstallLocal() does ... ie. end with
self.install(po=po) as I think that will also fix this.
 The later seems better to me, but I wouldn't bet houses on it.


-- 
James Antill <james at fedoraproject.org>
Fedora


More information about the Yum-devel mailing list