summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-07 15:39:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-07 16:00:05 +0000
commit47f359f9b017f8d99d0bb2161ac0dcefcbd915de (patch)
tree436d2e5fa9cda295a16f81e0d4772217073c75c1
parent03aae96a8859409b1ce7e3d5c1197371fa96bd14 (diff)
downloadbitbake-contrib-47f359f9b017f8d99d0bb2161ac0dcefcbd915de.tar.gz
bitbake-contrib-47f359f9b017f8d99d0bb2161ac0dcefcbd915de.tar.bz2
bitbake-contrib-47f359f9b017f8d99d0bb2161ac0dcefcbd915de.zip
utils: Use utils.remove() within prunedir()
We've already tweaked remove() for speed and not to error if it races for deletion. Therefore use this for prunedir() which was starting to show the same bug reports. [YOCTO #13003] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/utils.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 13bb5f2a05..f687ee4127 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -708,15 +708,7 @@ def prunedir(topdir):
# CAUTION: This is dangerous!
if _check_unsafe_delete_path(topdir):
raise Exception('bb.utils.prunedir: called with dangerous path "%s", refusing to delete!' % topdir)
- for root, dirs, files in os.walk(topdir, topdown = False):
- for name in files:
- os.remove(os.path.join(root, name))
- for name in dirs:
- if os.path.islink(os.path.join(root, name)):
- os.remove(os.path.join(root, name))
- else:
- os.rmdir(os.path.join(root, name))
- os.rmdir(topdir)
+ remove(topdir, recurse=True)
#
# Could also use return re.compile("(%s)" % "|".join(map(re.escape, suffixes))).sub(lambda mo: "", var)