[elbe-devel] [PATCH] efilesystem: Handle missing pkg-list node

Torben Hohn torben.hohn at linutronix.de
Tue Jul 21 12:23:53 CEST 2020


On Mon, Jul 20, 2020 at 08:34:23PM -0400, Olivier Dion wrote:
> Check if pkg-list node exists.  If it doesn't the list of package is
> empty and emit a warning.
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>

Hmm... you emit a warning, and you have to activate 
pylint: disable=too-many-statements

Lets just forbid this via dbsfed.xsd, please.

> ---
>  elbepack/efilesystem.py | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
> index 40865c28..216f17f5 100644
> --- a/elbepack/efilesystem.py
> +++ b/elbepack/efilesystem.py
> @@ -95,11 +95,20 @@ def extract_target(src, xml, dst, cache):
>  
>      # pylint: disable=too-many-locals
>      # pylint: disable=too-many-branches
> +    # pylint: disable=too-many-statements
>  
>      # create filelists describing the content of the target rfs
>      if xml.tgt.has("tighten") or xml.tgt.has("diet"):
> -        pkglist = [n.et.text for n in xml.node(
> -            'target/pkg-list') if n.tag == 'pkg']
> +
> +        if xml.has("target/pkg-list"):
> +            pkglist = [n.et.text
> +                       for n
> +                       in xml.node('target/pkg-list')
> +                       if n.tag == 'pkg']
> +        else:
> +            pkglist = []
> +            logging.warning("No <pkg-list> for project with <tighten> or <diet>")
> +
>          arch = xml.text("project/buildimage/arch", key="arch")
>  
>          if xml.tgt.has("diet"):
> @@ -145,8 +154,16 @@ def extract_target(src, xml, dst, cache):
>          pass
>  
>      if xml.tgt.has("setsel"):
> -        pkglist = [n.et.text for n in xml.node(
> -            'target/pkg-list') if n.tag == 'pkg']
> +
> +        if xml.has("target/pkg-list"):
> +            pkglist = [n.et.text
> +                       for n
> +                       in xml.node('target/pkg-list')
> +                       if n.tag == 'pkg']
> +        else:
> +            pkglist = []
> +            logging.warning("No <pkglist> for project with <setsel>")
> +
>          psel = 'var/cache/elbe/pkg-selections'
>  
>          with open(dst.fname(psel), 'w+') as f:
> -- 
> 2.27.0
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner


More information about the elbe-devel mailing list