[elbe-devel] [PATCH 1/2] Handle XML includes

Torben Hohn torben.hohn at linutronix.de
Thu Feb 23 10:14:35 CET 2017


On Wed, Feb 22, 2017 at 06:27:13PM +0100, Benedikt Spranger wrote:
> Add recognizion of Xincludes in E.L.B.E. XML recipes.
> 
> Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
> ---
>  elbepack/soapclient.py | 33 +++++++++++++++++++--------------
>  elbepack/treeutils.py  |  5 +++--
>  2 files changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
> index bc38a61..eeee328 100644
> --- a/elbepack/soapclient.py
> +++ b/elbepack/soapclient.py
> @@ -20,6 +20,11 @@
>  
>  from __future__ import print_function
>  
> +try:
> +    from cStringIO import StringIO
> +except:
> +    from StringIO import StringIO
> +

Please use io.BytesIO, which also supports with, and
would just fit into the existing code.

However... please make a separate command, and dont integrate this
into low-level calls.

We might want to set include paths, and all kinds of stuff, which
has no place in elbe control.





>  import binascii
>  from suds.client import Client
>  from urllib2 import URLError
> @@ -233,26 +238,26 @@ class SetXmlAction(ClientAction):
>  
>          size = 1024 * 1024
>          part = 0
> -        with file (filename, "r") as fp:
> -            while (True):
> -                xml_base64 = binascii.b2a_base64(fp.read (size))
> -                # finish upload
> -                if len (xml_base64) == 1:
> -                    part = client.service.upload_file (builddir,
> +        fp = StringIO(x.xml.tostring())
> +        while (True):
> +            xml_base64 = binascii.b2a_base64(fp.read (size))
> +            # finish upload
> +            if len (xml_base64) == 1:
> +                part = client.service.upload_file (builddir,
>                                                         "source.xml",

-- 
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/20170223/50bca404/attachment.sig>


More information about the elbe-devel mailing list