summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/buildproject.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-25 16:14:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-07 15:10:33 +0100
commitdd1f464f36e0c073f7d12a14536bc19dd154ac8a (patch)
treec815dbeac964ee388f97410d2288bfb2f08a5580 /meta/lib/oeqa/utils/buildproject.py
parente22125b0c20b213364a8456df8f69a31e735ca61 (diff)
downloadpoky-dd1f464f36e0c073f7d12a14536bc19dd154ac8a.tar.gz
oeqa/buildproject: Ensure temp directories are cleaned up
(From OE-Core rev: 15db91abd152aa3d22d24f951ba7663ab59ff7eb) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit d10aff865120a5feecc42c24726bd119364e0188) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/buildproject.py')
-rw-r--r--meta/lib/oeqa/utils/buildproject.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/buildproject.py b/meta/lib/oeqa/utils/buildproject.py
index e6d80cc8dc..dfb9661868 100644
--- a/meta/lib/oeqa/utils/buildproject.py
+++ b/meta/lib/oeqa/utils/buildproject.py
@@ -18,6 +18,7 @@ class BuildProject(metaclass=ABCMeta):
18 def __init__(self, uri, foldername=None, tmpdir=None, dl_dir=None): 18 def __init__(self, uri, foldername=None, tmpdir=None, dl_dir=None):
19 self.uri = uri 19 self.uri = uri
20 self.archive = os.path.basename(uri) 20 self.archive = os.path.basename(uri)
21 self.tempdirobj = None
21 if not tmpdir: 22 if not tmpdir:
22 self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-') 23 self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-')
23 tmpdir = self.tempdirobj.name 24 tmpdir = self.tempdirobj.name
@@ -57,6 +58,8 @@ class BuildProject(metaclass=ABCMeta):
57 return self._run('cd %s; make install %s' % (self.targetdir, install_args)) 58 return self._run('cd %s; make install %s' % (self.targetdir, install_args))
58 59
59 def clean(self): 60 def clean(self):
61 if self.tempdirobj:
62 self.tempdirobj.cleanup()
60 if not self.needclean: 63 if not self.needclean:
61 return 64 return
62 self._run('rm -rf %s' % self.targetdir) 65 self._run('rm -rf %s' % self.targetdir)