[elbe-devel] [PATCH 2/3] Add a E.L.B.E. preprocessor command

Torben Hohn torben.hohn at linutronix.de
Fri Mar 24 09:05:06 CET 2017


On Thu, Mar 23, 2017 at 02:14:20PM +0100, Benedikt Spranger wrote:
> Resolving Xincludes or other XML lowlevel features like external resources,
> XLink or other may disturb the internel E.L.B.E. XML handling. Add a
> preprocessor command to resolve these features and create a flat E.L.B.E.
> XML file.
> 
> Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
> ---
>  elbepack/commands/preprocess.py | 41 +++++++++++++++++++++++++++++++
>  elbepack/initvmaction.py        | 12 ++++++++++
>  elbepack/xmlpreprocess.py       | 53 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 106 insertions(+)
>  create mode 100644 elbepack/commands/preprocess.py
>  create mode 100644 elbepack/xmlpreprocess.py
> 
> diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
> index ed28e1c..bb865c6 100644
> --- a/elbepack/initvmaction.py
> +++ b/elbepack/initvmaction.py
> @@ -27,6 +27,8 @@ from elbepack.shellhelper import CommandError, system, command_out_stderr
>  from elbepack.filesystem  import wdfs, TmpdirFilesystem, Filesystem
>  from elbepack.elbexml     import ElbeXML, ValidationError
>  
> +from tempfile import NamedTemporaryFile
> +
>  import sys
>  import time
>  import os
> @@ -506,6 +508,16 @@ class SubmitAction(InitVMAction):
>                  print ('Unknown file ending (use either xml or iso)', file=sys.stderr)
>                  sys.exit (20)
>  
> +            outxml = NamedTemporaryFile(prefix='elbe', suffix='xml')
> +            cmd = '%s preprocess -o %s %s' % (elbe_exe, outxml.name, xmlfile)
> +            ret, msg, err = command_out_stderr (cmd)
> +            if ret != 0:
> +                print ("elbe preprocess failed.", file=sys.stderr)
> +                print (err, file=sys.stderr)
> +                print ("Giving up", file=sys.stderr)
> +                sys.exit(20)
> +            xmlfile = outxml.name
> +

We call the preprocessor for source.xml extracted from a cdrom also.
Do we want that ?
I tend to think, that we dont want that.

Also... the preprocessor is not called for elbe initvm create. 
I am pretty sure, we also want it called for initvm create.

>              ret, prjdir, err = command_out_stderr ('%s control create_project' % (elbe_exe))
>              if ret != 0:
>                  print ("elbe control create_project failed.", file=sys.stderr)

-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20170324/63d53f9e/attachment.sig>


More information about the elbe-devel mailing list