[elbe-devel] [PATCH v2 21/24] elbeproject: add a test to generate the SDK scripts

Torben Hohn torben.hohn at linutronix.de
Thu Feb 8 17:20:56 CET 2018


On Thu, Feb 08, 2018 at 02:17:07PM +0100, Manuel Traut wrote:
> during developing the SDK scripts the actual generation of the scripts
> by ./elbe build_sdk needs a couple of minutes. To ease development
> they can now be generated by
> 
> nosetests ./elbepack/elbeproject.py
> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>

has to be applied together with patch 23 

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
>  elbepack/elbeproject.py | 49 ++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 32 insertions(+), 17 deletions(-)
> 
> diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
> index cac3d88f..27b92bb0 100644
> --- a/elbepack/elbeproject.py
> +++ b/elbepack/elbeproject.py
> @@ -70,6 +70,36 @@ class UnsupportedSDKException(Exception):
>          Exception.__init__(self, "SDK for %s currently unsupported" % triplet)
>  
>  
> +def test_gen_sdk_scripts():
> +    os.system("mkdir -p /tmp/test/sdk")
> +    __gen_sdk_scripts('armhf-linux-gnueabihf',
> +                      'testproject',
> +                      '08.15',
> +                      '/tmp/test',
> +                      '/tmp/test/sdk')
> +
> +
> +def __gen_sdk_scripts(triplet, prj_name, prj_version, builddir, sdkpath):
> +
> +    # generate the setup script
> +    sdkvalues = { 'sdk_arch': 'x86_64',
> +                  'sdk_gcc_ver': '',
> +                  'sdk_path': '/opt/elbe-sdk',
> +                  'sdk_ext_path': '~/elbe-sdk',
> +                  'real_multimach_target_sys': triplet,
> +                  'sdk_title': 'ELBE %s' % prj_name,
> +                  'sdk_version': prj_version,
> +                }
> +    t = os.path.join(mako_template_dir, 'toolchain-shar-extract.sh.mako')
> +    with open(os.path.join(builddir, 'setup-sdk.sh'), 'w') as f:
> +        f.write(template(t, sdkvalues))
> +
> +    t = os.path.join(mako_template_dir, 'environment-setup-elbe.mako')
> +    with open(os.path.join(sdkpath,
> +                           'environment-setup-elbe'), 'w') as f:
> +        f.write(template(t, sdkvalues))
> +
> +
>  class ElbeProject (object):
>      def __init__(
>              self,
> @@ -263,23 +293,8 @@ class ElbeProject (object):
>                      'amd64',
>                      True)
>  
> -        # generate the setup script
> -        sdkvalues = { 'sdk_arch': 'x86_64',
> -                      'sdk_gcc_ver': '',
> -                      'sdk_path': '/opt/elbe-sdk',
> -                      'sdk_ext_path': '~/elbe-sdk',
> -                      'real_multimach_target_sys': triplet,
> -                      'sdk_title': 'ELBE %s' % self.xml.text("project/name"),
> -                      'sdk_version': self.xml.text("project/version"),
> -                    }
> -        t = os.path.join(mako_template_dir, 'toolchain-shar-extract.sh.mako')
> -        with open(os.path.join(self.builddir, 'setup-sdk.sh'), 'w') as f:
> -            f.write(template(t, sdkvalues))
> -
> -        t = os.path.join(mako_template_dir, 'environment-setup-elbe.mako')
> -        with open(os.path.join(self.sdkpath,
> -                               'environment-setup-elbe'), 'w') as f:
> -            f.write(template(t, sdkvalues))
> +        __gen_sdk_scripts(triplet, prj_name, prj_version,
> +                          self.builddir, self.sdkpath)
>  
>          # create sdk tar and append it to setup script
>          self.log.do("cd %s; tar cJf ../sdk.txz ." % self.sdkpath)
> -- 
> 2.15.1
> 

-- 
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: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20180208/2fa9222d/attachment.sig>


More information about the elbe-devel mailing list