summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-11-02 17:52:55 +0000
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-11-07 12:02:43 +0000
commit261e2cd30ca126841265673c7edf8a1d0cd2a2d2 (patch)
treecb8cb21b48ae372805f0609d7bbf503c751e22f4
parent029ba17dd7c4f5cd2f7180e9252fdd5376143816 (diff)
downloadbuildstream-jmac/make_writable_combination.tar.gz
element.py: Use _force_rmtree instead of custom code.jmac/make_writable_combination
There are arguments for and against using onerror - see issue #735 for details.
-rw-r--r--buildstream/element.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 8ec06090c..31ca5d307 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1410,16 +1410,9 @@ class Element(Plugin):
finally:
# Staging may produce directories with less than 'rwx' permissions
- # for the owner, which will break tempfile, so we need to use chmod
- # occasionally.
- def make_dir_writable(fn, path, excinfo):
- os.chmod(os.path.dirname(path), 0o777)
- if os.path.isdir(path):
- os.rmdir(path)
- else:
- os.remove(path)
- shutil.rmtree(temp_staging_directory, onerror=make_dir_writable)
-
+ # for the owner, which breaks tempfile. _force_rmtree will deal
+ # with these.
+ utils._force_rmtree(temp_staging_directory)
# Ensure deterministic mtime of sources at build time
vdirectory.set_deterministic_mtime()
# Ensure deterministic owners of sources at build time