diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2017-04-05 13:10:53 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-06 10:13:34 +0100 |
commit | 9425c2658fea0b45468a04574cd77bffc6668a8d (patch) | |
tree | 6d25f519b9857262325732e9584e690ccff39277 /meta | |
parent | 3a1cce659156ef2654a55a6e3c6922fa2dc780e4 (diff) | |
download | openembedded-core-9425c2658fea0b45468a04574cd77bffc6668a8d.tar.gz openembedded-core-9425c2658fea0b45468a04574cd77bffc6668a8d.tar.bz2 openembedded-core-9425c2658fea0b45468a04574cd77bffc6668a8d.zip |
oeqa/utils/buildproject: create a more unique tmp dir
Rather than hardcoding /tmp as the default tmpdir make a more unique tmpdir
with tempfile.mkdtemp() when the caller doesn't specify a tmpdir value.
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/utils/buildproject.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/buildproject.py b/meta/lib/oeqa/utils/buildproject.py index fc8879cfb8..487f08be49 100644 --- a/meta/lib/oeqa/utils/buildproject.py +++ b/meta/lib/oeqa/utils/buildproject.py @@ -8,14 +8,17 @@ import os import re import subprocess import shutil +import tempfile from abc import ABCMeta, abstractmethod class BuildProject(metaclass=ABCMeta): - def __init__(self, uri, foldername=None, tmpdir="/tmp/", dl_dir=None): + def __init__(self, uri, foldername=None, tmpdir=None, dl_dir=None): self.uri = uri self.archive = os.path.basename(uri) - self.localarchive = os.path.join(tmpdir,self.archive) + if not tmpdir: + tmpdir = tempfile.mkdtemp(prefix='buildproject') + self.localarchive = os.path.join(tmpdir, self.archive) self.dl_dir = dl_dir if foldername: self.fname = foldername |