[elbe-devel] [PATCH v3] preprocess: introduce compression level

Torben Hohn torben.hohn at linutronix.de
Wed Oct 16 10:35:03 CEST 2019


On Mon, Oct 14, 2019 at 06:24:21PM +0200, bage at linutronix.de wrote:
> From: Bastian Germann <bage at linutronix.de>
> 
> elbe preprocess uses preprocess.xml as default file name but applies a
> gzip compression unexpectedly. Introduce a parameter to explicitly set
> the gzip compression level.

hmm... not sure, if i like it to default to 0

The preprocessed file is not seen by the user when he uses
"elbe initvm submit"


> 
> Closes #213.
> 
> Signed-off-by: Bastian Germann <bage at linutronix.de>
> ---
>  elbepack/commands/preprocess.py | 5 ++++-
>  elbepack/xmlpreprocess.py       | 4 ++--
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/elbepack/commands/preprocess.py b/elbepack/commands/preprocess.py
> index 44e298c4..eeedffec 100644
> --- a/elbepack/commands/preprocess.py
> +++ b/elbepack/commands/preprocess.py
> @@ -23,6 +23,9 @@ def run_command(argv):
>      oparser.add_option("-o", "--output", dest="output",
>                         default="preprocess.xml",
>                         help="preprocessed output file", metavar="<xmlfile>")
> +    oparser.add_option("-z", "--gzip", dest="gzip", type="int",
> +                       default=0,
> +                       help="gzip compression level 1-9 (0: no compression)", metavar="<level>")

this option should be a pass_through_option, shouldnt it ?
in that case it will automatically be added to "elbe initvm" and "elbe
pbuilder" via PreprocessWrapper.add_options()


also... changes to man pages are missing.


>      add_pass_through_options(oparser)
>      (opt, args) = oparser.parse_args(argv)
>  
> @@ -40,7 +43,7 @@ def run_command(argv):
>          variants = opt.variant.split(',')
>  
>      try:
> -        xmlpreprocess(args[0], opt.output, variants)
> +        xmlpreprocess(args[0], opt.output, variants, opt.gzip)
>      except XMLPreprocessError as e:
>          print(e, file=sys.stderr)
>          sys.exit(20)
> diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
> index 598ced45..ea1cac80 100644
> --- a/elbepack/xmlpreprocess.py
> +++ b/elbepack/xmlpreprocess.py
> @@ -84,7 +84,7 @@ def preprocess_initvm_ports(xml):
>              forward.getparent().remove(forward)
>  
>  
> -def xmlpreprocess(fname, output, variants=None):
> +def xmlpreprocess(fname, output, variants=None, gzip=0):
>  
>      # pylint: disable=too-many-locals
>      # pylint: disable=too-many-branches
> @@ -164,7 +164,7 @@ def xmlpreprocess(fname, output, variants=None):
>                  output,
>                  encoding="UTF-8",
>                  pretty_print=True,
> -                compression=9)
> +                compression=gzip)
>              # the rest of the code is exception and error handling
>              return
>  
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> 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