bitbake: 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]

(Bitbake rev: 47f359f9b017f8d99d0bb2161ac0dcefcbd915de)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2018-12-07 15:39:15 +00:00
parent e74f80433e
commit 888d76d221

View File

@@ -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)