This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch tlater/casd-socket-permissions
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 5822e0f7b8e79e306f88b93338e7325feacefaae
Author: Tristan Maat <[email protected]>
AuthorDate: Thu Nov 7 16:16:30 2019 +0000

    element.py: Make build directory a proper utils._tempdir
---
 src/buildstream/element.py       | 9 +--------
 tests/testutils/artifactshare.py | 2 --
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 7bb8bc0..f94dcd1 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1644,13 +1644,8 @@ class Element(Plugin):
 
             # Explicitly clean it up, keep the build dir around if exceptions 
are raised
             os.makedirs(context.builddir, exist_ok=True)
-            rootdir = tempfile.mkdtemp(prefix="{}-".format(self.normal_name), 
dir=context.builddir)
-
-            # Cleanup the build directory on explicit SIGTERM
-            def cleanup_rootdir():
-                utils._force_rmtree(rootdir)
 
-            with _signals.terminator(cleanup_rootdir), \
+            with utils._group_tempdir(prefix="{}-".format(self.normal_name), 
dir=context.builddir) as rootdir, \
                 self.__sandbox(rootdir, output_file, output_file, 
self.__sandbox_config) as sandbox:  # noqa
 
                 # Let the sandbox know whether the buildtree will be required.
@@ -1703,8 +1698,6 @@ class Element(Plugin):
                     raise
                 else:
                     return self._cache_artifact(rootdir, sandbox, collect)
-                finally:
-                    cleanup_rootdir()
 
     def _cache_artifact(self, rootdir, sandbox, collect):
 
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index ba02d39..52e2708 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -195,8 +195,6 @@ class ArtifactShare():
 
         self.cas.release_resources()
 
-        shutil.rmtree(self.directory)
-
 
 # create_artifact_share()
 #

Reply via email to