poky/meta/lib/oeqa/runtime/utils/targetbuildproject.py
Joshua Lock 633ad6c9f4 oeqa/runtime/utils/targetbuildproject: use parent classes defaults tmpdir
Rather than hard-coding the tmpdir for TargetBuildProject to /tmp allow the
parent's default handling to define an appropriate tmpdir.

(From OE-Core rev: 901659a51cd53625a93f57a9c5865e90a07ec09d)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-06 10:13:39 +01:00

40 lines
1.4 KiB
Python

# Copyright (C) 2016 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
from oeqa.utils.buildproject import BuildProject
class TargetBuildProject(BuildProject):
def __init__(self, target, uri, foldername=None, dl_dir=None):
self.target = target
self.targetdir = "~/"
BuildProject.__init__(self, uri, foldername, dl_dir=dl_dir)
def download_archive(self):
self._download_archive()
status, output = self.target.copyTo(self.localarchive, self.targetdir)
if status:
raise Exception('Failed to copy archive to target, '
'output: %s' % output)
cmd = 'tar xf %s%s -C %s' % (self.targetdir,
self.archive,
self.targetdir)
status, output = self.target.run(cmd)
if status:
raise Exception('Failed to extract archive, '
'output: %s' % output)
# Change targetdir to project folder
self.targetdir = self.targetdir + self.fname
# The timeout parameter of target.run is set to 0
# to make the ssh command run with no timeout.
def _run(self, cmd):
ret = self.target.run(cmd, 0)
msg = "Command %s failed with exit code %s: %s" % (cmd, ret[0], ret[1])
if ret[0] != 0:
raise Exception(msg)
return ret[0]