[PATCH] auto-update-debuginfo: don't update cache when -C. BZ 1002449

James Antill james at fedoraproject.org
Wed Sep 11 14:37:33 UTC 2013


 Sorry, I did look at this and meant to reply but must have not marked
it as unread again ... anyway.

On Thu, 2013-08-29 at 12:06 +0200, Zdenek Pavlas wrote:
> - _write_cached() should be probably avoided when cacheonly.

 Maybe, I thought we were changing so that cacheonly just meant "don't
talk over the network".

> - when we can't cache the result, we should not run the slow
>   len(returnPackages) path at all.

 Why? That's the only way to get the correct result, if we don't have it
cached.

> - the cached num, even if stale, is better than assuming num==0.

 Sure, but we can just work it out and get the correct result.

> ---
>  plugins/auto-update-debuginfo/auto-update-debuginfo.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/plugins/auto-update-debuginfo/auto-update-debuginfo.py b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
> index 539dc91..c0fa85a 100644
> --- a/plugins/auto-update-debuginfo/auto-update-debuginfo.py
> +++ b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
> @@ -103,12 +103,12 @@ def prereposetup_hook(conduit):
>      if caching:
>          cfname = yb.conf.persistdir + '/plugins/auto-update-debuginfo/num'
>          crpmdbv, num = _read_cached(cfname)
> -        if num is not None:
> +        if num is not None and not yb.conf.cache:
>              rpmdbv = yb.rpmdb.simpleVersion(main_only=True)[0]
>              if rpmdbv != crpmdbv:
>                  num = None

 What is the logic here? If we have the correctly cached result why does
it matter if we are in cacheonly mode or not?


> -    if num is None:
> +    if num is None and not yb.conf.cache:
>          num = len(yb.rpmdb.returnPackages(patterns=['*-debuginfo']))
>          if caching:
>              rpmdbv = yb.rpmdb.simpleVersion(main_only=True)[0]

 This does make things faster ... but will give the wrong result. If we
really need to make this part faster we could maybe change the caching
to cache the *-debuginfo package names that we've seen before ... then
we don't really need much of a caching validation mechanism for the
exists case as we can just lookup the packages by name (almost instant
op.) and as soon as we find one we are good.



More information about the Yum-devel mailing list