Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/3] oeqa: don't litter /tmp with temporary directories
@ 2018-12-03 20:35 Ross Burton
  2018-12-03 20:35 ` [PATCH 2/3] oeqa/selftest/esdk: run selftest inside workdir not /tmp Ross Burton
  2018-12-03 20:35 ` [PATCH 3/3] insane: clarify GNU_HASH warning Ross Burton
  0 siblings, 2 replies; 3+ messages in thread
From: Ross Burton @ 2018-12-03 20:35 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/lib/oeqa/utils/buildproject.py | 5 ++++-
 meta/lib/oeqa/utils/targetbuild.py  | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/utils/buildproject.py b/meta/lib/oeqa/utils/buildproject.py
index 7e9b84955f5..524015ede4b 100644
--- a/meta/lib/oeqa/utils/buildproject.py
+++ b/meta/lib/oeqa/utils/buildproject.py
@@ -17,7 +17,10 @@ class BuildProject(metaclass=ABCMeta):
         self.uri = uri
         self.archive = os.path.basename(uri)
         if not tmpdir:
-            tmpdir = tempfile.mkdtemp(prefix='buildproject')
+            tmpdir = self.d.getVar('WORKDIR')
+            if not tmpdir:
+                self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-')
+                tmpdir = self.tempdirobj.name
         self.localarchive = os.path.join(tmpdir, self.archive)
         self.dl_dir = dl_dir
         if foldername:
diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py
index 1202d579fb0..b8db7b2aca0 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:
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-03 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-03 20:35 [PATCH 1/3] oeqa: don't litter /tmp with temporary directories Ross Burton
2018-12-03 20:35 ` [PATCH 2/3] oeqa/selftest/esdk: run selftest inside workdir not /tmp Ross Burton
2018-12-03 20:35 ` [PATCH 3/3] insane: clarify GNU_HASH warning Ross Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox