diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2017-04-05 13:10:54 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-06 10:13:34 +0100 |
commit | c43c966e0ed4ed836bdf90b1d4c3f2f45426f1ec (patch) | |
tree | eb04232d0a20febc475703164c5754a377b71102 /meta/lib/oeqa | |
parent | 9425c2658fea0b45468a04574cd77bffc6668a8d (diff) | |
download | openembedded-core-c43c966e0ed4ed836bdf90b1d4c3f2f45426f1ec.tar.gz openembedded-core-c43c966e0ed4ed836bdf90b1d4c3f2f45426f1ec.tar.bz2 openembedded-core-c43c966e0ed4ed836bdf90b1d4c3f2f45426f1ec.zip |
oeqa/utils/targetbuild: tmp dir improvements
Don't hard-code /tmp as the tmpdir, instead use WORKDIR as the tmpdir if the
instantiater doesn't specify a value.
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-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 import re import bb.utils import subprocess +import tempfile from abc import ABCMeta, abstractmethod class BuildProject(metaclass=ABCMeta): - def __init__(self, d, uri, foldername=None, tmpdir="/tmp/"): + def __init__(self, d, uri, foldername=None, tmpdir=None): self.d = d self.uri = uri self.archive = os.path.basename(uri) + if not tmpdir: + tmpdir = self.d.getVar('WORKDIR') + if not tmpdir: + tmpdir = tempfile.mkdtemp(prefix='buildproject') self.localarchive = os.path.join(tmpdir,self.archive) if foldername: self.fname = foldername @@ -24,7 +29,6 @@ class BuildProject(metaclass=ABCMeta): # Download self.archive to self.localarchive def _download_archive(self): - dl_dir = self.d.getVar("DL_DIR") if dl_dir and os.path.exists(os.path.join(dl_dir, self.archive)): bb.utils.copyfile(os.path.join(dl_dir, self.archive), self.localarchive) @@ -73,7 +77,7 @@ class TargetBuildProject(BuildProject): def __init__(self, target, d, uri, foldername=None): self.target = target self.targetdir = "~/" - BuildProject.__init__(self, d, uri, foldername, tmpdir="/tmp") + BuildProject.__init__(self, d, uri, foldername) def download_archive(self): |