diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/utils/sdkbuildproject.py')
-rw-r--r-- | meta/lib/oeqa/sdk/utils/sdkbuildproject.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/utils/sdkbuildproject.py b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py new file mode 100644 index 0000000000..1eebd3a5bc --- /dev/null +++ b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py | |||
@@ -0,0 +1,45 @@ | |||
1 | # Copyright (C) 2016 Intel Corporation | ||
2 | # Released under the MIT license (see COPYING.MIT) | ||
3 | |||
4 | import os | ||
5 | import subprocess | ||
6 | |||
7 | from oeqa.utils.buildproject import BuildProject | ||
8 | |||
9 | class SDKBuildProject(BuildProject): | ||
10 | |||
11 | def __init__(self, testpath, sdkenv, d, uri, foldername=None): | ||
12 | self.sdkenv = sdkenv | ||
13 | self.testdir = testpath | ||
14 | self.targetdir = testpath | ||
15 | bb.utils.mkdirhier(testpath) | ||
16 | self.datetime = d.getVar('DATETIME') | ||
17 | self.testlogdir = d.getVar("TEST_LOG_DIR") | ||
18 | bb.utils.mkdirhier(self.testlogdir) | ||
19 | self.logfile = os.path.join(self.testlogdir, "sdk_target_log.%s" % self.datetime) | ||
20 | BuildProject.__init__(self, d, uri, foldername, tmpdir=testpath) | ||
21 | |||
22 | def download_archive(self): | ||
23 | |||
24 | self._download_archive() | ||
25 | |||
26 | cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir) | ||
27 | subprocess.check_call(cmd, shell=True) | ||
28 | |||
29 | #Change targetdir to project folder | ||
30 | self.targetdir = os.path.join(self.targetdir, self.fname) | ||
31 | |||
32 | def run_configure(self, configure_args='', extra_cmds=' gnu-configize; '): | ||
33 | return super(SDKBuildProject, self).run_configure(configure_args=(configure_args or '$CONFIGURE_FLAGS'), extra_cmds=extra_cmds) | ||
34 | |||
35 | def run_install(self, install_args=''): | ||
36 | return super(SDKBuildProject, self).run_install(install_args=(install_args or "DESTDIR=%s/../install" % self.targetdir)) | ||
37 | |||
38 | def log(self, msg): | ||
39 | if self.logfile: | ||
40 | with open(self.logfile, "a") as f: | ||
41 | f.write("%s\n" % msg) | ||
42 | |||
43 | def _run(self, cmd): | ||
44 | self.log("Running . %s; " % self.sdkenv + cmd) | ||
45 | return subprocess.call(". %s; " % self.sdkenv + cmd, shell=True) | ||