[Yum-devel] [PATCH] yum-security backtrace fix and huge speed improvement

Tim Lauridsen tla at rasmil.dk
Tue Jul 24 05:59:12 UTC 2007


James Antill wrote:
>  Sometime recently yum-security in "list updates mode"[1] has started
> causing backtraces and taking a huge amount of time.
>
>  For those that don't know the way plugins exclude items frfom "list
> updates" is to use the exclude_hook and call conduit.getPackages and the
> conduit.delPackage for any that they don't want.
>
>  The speed problem seems to be that conduit.delPackage() now takes about
> a quarter of a second or so, combined with having to remove most/all of
> the pacakges on the system.
>
>
>  The traceback is due to the fact that yum-security just did:
>
>   for pkg in conduit.getPackages():
>
> ...and this recurses into the function that calls the exclude plugins,
> YumBase._getSacks(), and is protected from that being a problem by
> doing:
>
>         if self._pkgSack and thisrepo is None:
>
> ...but if you remove _all_ of the packages the above fails. This can be
> fixed by just moving the getPackages to a variable before the for loop
> like:
>
> pkgs = conduit.getPackages()
> for pkg in pkgs:
>
> ...however I fixed that and the speed problem by instead doing:
>
> upds = conduit._base.doPackageLists(pkgnarrow='updates')
> pkgs = upds.updates
>
> ...this feels a little hacky, but it takes the runtime on my machine
> from about an hour to 5 seconds (so I feel a little justified :).
>  Another way to go is if we could test if the package is an
> update/installed etc, like:
>
> pkgs = conduit.getPackages()
> for pkg in pkgs:
>    if <pkg isn't installed already>:
>        # Do our normal work, incl. likely delPackage()
>
> ...but I don't think that's available at this point.
>
>  Full patch against yum-utils is attached.
>
> [1] Ie. yum list updates --security
>
>   
I have added the patch.
Tim



More information about the Yum-devel mailing list