[elbe-devel] [PATCH v2 15/22] check_updates: make use of the new methods and internal depcache in VirtApt

Bastian Germann bage at linutronix.de
Tue Jul 2 17:13:23 CEST 2019


> after adding methods, that take pgknames as paramters, and adding a
> DepCache member to VirtApt, make use of them in "elbe check_updates"
> 
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>

Reviewed-by: Bastian Germann <bage at linutronix.de>

> ---
>  elbepack/commands/check_updates.py | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/elbepack/commands/check_updates.py b/elbepack/commands/check_updates.py
> index 4e28bacc8..91ad160d5 100644
> --- a/elbepack/commands/check_updates.py
> +++ b/elbepack/commands/check_updates.py
> @@ -62,16 +62,13 @@ def run_command(argv):
>  
>      v = virtapt.VirtApt(xml)
>  
> -    d = virtapt.apt_pkg.DepCache(v.cache)
> -    d.read_pinfile(v.basefs.path + "/etc/apt/preferences")
> -
>      for p in fullp:
>          pname = p.et.text
>          pver = p.et.get('version')
>          pauto = p.et.get('auto')
>  
>          if pauto != "true":
> -            d.mark_install(v.cache[pname])
> +            v.mark_install(pname)
>  
>      errors = 0
>      required_updates = 0
> @@ -81,7 +78,7 @@ def run_command(argv):
>          pver = p.et.get('version')
>          pauto = p.et.get('auto')
>  
> -        if pname not in v.cache:
> +        if not v.has_pkg(pname):
>              if pauto == 'false':
>                  print(
>                      "%s does not exist in cache but is specified in pkg-list" %
> @@ -93,10 +90,8 @@ def run_command(argv):
>  
>              continue
>  
> -        centry = v.cache[pname]
> -
> -        if d.marked_install(centry):
> -            cver = d.get_candidate_ver(v.cache[pname]).ver_str
> +        if v.marked_install(pname):
> +            cver = v.get_candidate_ver(pname)
>              if pver != cver:
>                  print("%s: %s != %s" % (pname, pver, cver))
>                  required_updates += 1
> 



More information about the elbe-devel mailing list