diff options
| -rw-r--r-- | meta/lib/oeqa/utils/targetbuild.py | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py index 9b2cf53773..77181b1c3d 100644 --- a/meta/lib/oeqa/utils/targetbuild.py +++ b/meta/lib/oeqa/utils/targetbuild.py | |||
| @@ -4,11 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | # Provides a class for automating build tests for projects | 5 | # Provides a class for automating build tests for projects |
| 6 | 6 | ||
| 7 | from oeqa.oetest import oeRuntimeTest | ||
| 8 | import bb.fetch2 | ||
| 9 | import bb.data | ||
| 10 | import os | 7 | import os |
| 11 | import re | 8 | import re |
| 9 | import subprocess | ||
| 12 | 10 | ||
| 13 | 11 | ||
| 14 | class TargetBuildProject(): | 12 | class TargetBuildProject(): |
| @@ -16,26 +14,16 @@ class TargetBuildProject(): | |||
| 16 | def __init__(self, target, uri, foldername=None): | 14 | def __init__(self, target, uri, foldername=None): |
| 17 | self.target = target | 15 | self.target = target |
| 18 | self.uri = uri | 16 | self.uri = uri |
| 19 | self.targetdir = "/home/root/" | 17 | self.targetdir = "~/" |
| 20 | 18 | self.archive = os.path.basename(uri) | |
| 21 | self.localdata = bb.data.createCopy(oeRuntimeTest.tc.d) | 19 | self.localarchive = "/tmp/" + self.archive |
| 22 | bb.data.update_data(self.localdata) | 20 | self.fname = re.sub(r'.tar.bz2|tar.gz$', '', self.archive) |
| 23 | 21 | if foldername: | |
| 24 | if not foldername: | ||
| 25 | self.archive = os.path.basename(uri) | ||
| 26 | self.fname = re.sub(r'.tar.bz2|tar.gz$', '', self.archive) | ||
| 27 | else: | ||
| 28 | self.fname = foldername | 22 | self.fname = foldername |
| 29 | 23 | ||
| 30 | def download_archive(self): | 24 | def download_archive(self): |
| 31 | 25 | ||
| 32 | try: | 26 | subprocess.check_call("wget -O %s %s" % (self.localarchive, self.uri), shell=True) |
| 33 | self.localdata.delVar("BB_STRICT_CHECKSUM") | ||
| 34 | fetcher = bb.fetch2.Fetch([self.uri], self.localdata) | ||
| 35 | fetcher.download() | ||
| 36 | self.localarchive = fetcher.localpath(self.uri) | ||
| 37 | except bb.fetch2.BBFetchException: | ||
| 38 | raise Exception("Failed to download archive: %s" % self.uri) | ||
| 39 | 27 | ||
| 40 | (status, output) = self.target.copy_to(self.localarchive, self.targetdir) | 28 | (status, output) = self.target.copy_to(self.localarchive, self.targetdir) |
| 41 | if status != 0: | 29 | if status != 0: |
| @@ -61,3 +49,4 @@ class TargetBuildProject(): | |||
| 61 | 49 | ||
| 62 | def clean(self): | 50 | def clean(self): |
| 63 | self.target.run('rm -rf %s' % self.targetdir) | 51 | self.target.run('rm -rf %s' % self.targetdir) |
| 52 | subprocess.call('rm -f %s' % self.localarchive, shell=True) | ||
