[elbe-devel] [PATCH v2 21/24] elbeproject: add a test to generate the SDK scripts
Manuel Traut
manut at linutronix.de
Thu Feb 8 14:17:07 CET 2018
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>
---
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
More information about the elbe-devel
mailing list