From affd7388f31813b7cb5f376905b13be6c4cbf0d1 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 3 Dec 2018 20:35:14 +0000 Subject: oeqa: don't litter /tmp with temporary directories If we need to create a temporary directory in targetbuild or buildproject use tempfile.TemporaryDirectory so that when the test case is finished, the directory is deleted. Also synchronise the logic and don't possibly store the temporary directory in self.tmpdir as nothing uses that. (From OE-Core rev: db0e658097130d146752785d0d45f46a3e0bad71) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/targetbuild.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'meta/lib/oeqa/utils/targetbuild.py') diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py index 1202d579fb..b8db7b2aca 100644 --- a/meta/lib/oeqa/utils/targetbuild.py +++ b/meta/lib/oeqa/utils/targetbuild.py @@ -20,8 +20,9 @@ class BuildProject(metaclass=ABCMeta): if not tmpdir: tmpdir = self.d.getVar('WORKDIR') if not tmpdir: - tmpdir = tempfile.mkdtemp(prefix='buildproject') - self.localarchive = os.path.join(tmpdir,self.archive) + self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-') + tmpdir = self.tempdirobj.name + self.localarchive = os.path.join(tmpdir, self.archive) if foldername: self.fname = foldername else: -- cgit v1.2.3-54-g00ecf