aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/utils/targetbuildproject.py
blob: 006d4d4a7b8a9d5988933b54ed431e8942994c9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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, tmpdir="/tmp",
                dl_dir=dl_dir)

    def download_archive(self):
        self._download_archive()

        (status, output) = self.target.copy_to(self.localarchive, self.targetdir)
        if status != 0:
            raise Exception("Failed to copy archive to target, output: %s" % output)

        (status, output) = self.target.run('tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir))
        if status != 0:
            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):
        return self.target.run(cmd, 0)[0]