diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2019-11-07 16:16:30 +0000 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2019-11-12 11:19:00 +0000 |
commit | 5822e0f7b8e79e306f88b93338e7325feacefaae (patch) | |
tree | 01d1a86ffdbd3b6d73265e8dda0b8512593ccbe1 | |
parent | cdbbe11baf3cc3d51fbc9159e52d4b6670225a94 (diff) | |
download | buildstream-5822e0f7b8e79e306f88b93338e7325feacefaae.tar.gz |
element.py: Make build directory a proper utils._tempdir
-rw-r--r-- | src/buildstream/element.py | 9 | ||||
-rw-r--r-- | tests/testutils/artifactshare.py | 2 |
2 files changed, 1 insertions, 10 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 7bb8bc093..f94dcd17c 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 ba02d397d..52e27082b 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() # |