From: Joshua Lock Date: Wed, 5 Apr 2017 12:10:53 +0000 (+0100) Subject: oeqa/utils/buildproject: create a more unique tmp dir X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~21742 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9425c2658fea0b45468a04574cd77bffc6668a8d;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oeqa/utils/buildproject.py b/meta/lib/oeqa/utils/buildproject.py index fc8879cfb82..487f08be496 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