diff options
| -rw-r--r-- | meta/lib/oeqa/utils/targetbuild.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py index 6f237b56f3..9249fa2635 100644 --- a/meta/lib/oeqa/utils/targetbuild.py +++ b/meta/lib/oeqa/utils/targetbuild.py | |||
| @@ -8,14 +8,19 @@ import os | |||
| 8 | import re | 8 | import re |
| 9 | import bb.utils | 9 | import bb.utils |
| 10 | import subprocess | 10 | import subprocess |
| 11 | import tempfile | ||
| 11 | from abc import ABCMeta, abstractmethod | 12 | from abc import ABCMeta, abstractmethod |
| 12 | 13 | ||
| 13 | class BuildProject(metaclass=ABCMeta): | 14 | class BuildProject(metaclass=ABCMeta): |
| 14 | 15 | ||
| 15 | def __init__(self, d, uri, foldername=None, tmpdir="/tmp/"): | 16 | def __init__(self, d, uri, foldername=None, tmpdir=None): |
| 16 | self.d = d | 17 | self.d = d |
| 17 | self.uri = uri | 18 | self.uri = uri |
| 18 | self.archive = os.path.basename(uri) | 19 | self.archive = os.path.basename(uri) |
| 20 | if not tmpdir: | ||
| 21 | tmpdir = self.d.getVar('WORKDIR') | ||
| 22 | if not tmpdir: | ||
| 23 | tmpdir = tempfile.mkdtemp(prefix='buildproject') | ||
| 19 | self.localarchive = os.path.join(tmpdir,self.archive) | 24 | self.localarchive = os.path.join(tmpdir,self.archive) |
| 20 | if foldername: | 25 | if foldername: |
| 21 | self.fname = foldername | 26 | self.fname = foldername |
| @@ -24,7 +29,6 @@ class BuildProject(metaclass=ABCMeta): | |||
| 24 | 29 | ||
| 25 | # Download self.archive to self.localarchive | 30 | # Download self.archive to self.localarchive |
| 26 | def _download_archive(self): | 31 | def _download_archive(self): |
| 27 | |||
| 28 | dl_dir = self.d.getVar("DL_DIR") | 32 | dl_dir = self.d.getVar("DL_DIR") |
| 29 | if dl_dir and os.path.exists(os.path.join(dl_dir, self.archive)): | 33 | if dl_dir and os.path.exists(os.path.join(dl_dir, self.archive)): |
| 30 | bb.utils.copyfile(os.path.join(dl_dir, self.archive), self.localarchive) | 34 | bb.utils.copyfile(os.path.join(dl_dir, self.archive), self.localarchive) |
| @@ -73,7 +77,7 @@ class TargetBuildProject(BuildProject): | |||
| 73 | def __init__(self, target, d, uri, foldername=None): | 77 | def __init__(self, target, d, uri, foldername=None): |
| 74 | self.target = target | 78 | self.target = target |
| 75 | self.targetdir = "~/" | 79 | self.targetdir = "~/" |
| 76 | BuildProject.__init__(self, d, uri, foldername, tmpdir="/tmp") | 80 | BuildProject.__init__(self, d, uri, foldername) |
| 77 | 81 | ||
| 78 | def download_archive(self): | 82 | def download_archive(self): |
| 79 | 83 | ||
