]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: utils: Use utils.remove() within prunedir()
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 7 Dec 2018 15:39:15 +0000 (15:39 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 8 Dec 2018 17:17:37 +0000 (17:17 +0000)
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>
bitbake/lib/bb/utils.py

index 13bb5f2a05825643f1b83eeca8b2b0e1e0e0a4a1..f687ee41277cdf9fcf84183272bd260deacc7481 100644 (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)