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:39 +0100 |
commit | 04cf8ad80e11f88257fb8278755c2710dde2c7e7 (patch) | |
tree | 917d7d33d4706fe29cebf7d89cc397af7b459227 /meta | |
parent | 3468b4d96cdaeddc4027514f22293c205d6619b7 (diff) | |
download | poky-04cf8ad80e11f88257fb8278755c2710dde2c7e7.tar.gz |
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.
(From OE-Core rev: 9425c2658fea0b45468a04574cd77bffc6668a8d)
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 | |||
8 | import re | 8 | import re |
9 | import subprocess | 9 | import subprocess |
10 | import shutil | 10 | import shutil |
11 | import tempfile | ||
11 | 12 | ||
12 | from abc import ABCMeta, abstractmethod | 13 | from abc import ABCMeta, abstractmethod |
13 | 14 | ||
14 | class BuildProject(metaclass=ABCMeta): | 15 | class BuildProject(metaclass=ABCMeta): |
15 | def __init__(self, uri, foldername=None, tmpdir="/tmp/", dl_dir=None): | 16 | def __init__(self, uri, foldername=None, tmpdir=None, dl_dir=None): |
16 | self.uri = uri | 17 | self.uri = uri |
17 | self.archive = os.path.basename(uri) | 18 | self.archive = os.path.basename(uri) |
18 | self.localarchive = os.path.join(tmpdir,self.archive) | 19 | if not tmpdir: |
20 | tmpdir = tempfile.mkdtemp(prefix='buildproject') | ||
21 | self.localarchive = os.path.join(tmpdir, self.archive) | ||
19 | self.dl_dir = dl_dir | 22 | self.dl_dir = dl_dir |
20 | if foldername: | 23 | if foldername: |
21 | self.fname = foldername | 24 | self.fname = foldername |