[17/22] package.bbclass: Simplify empty directory removal

Submitted by Richard Purdie on Feb. 3, 2013, 11:55 p.m.

Details

Message ID ddb80101c75e7cfa49414bc3d1965391904329ca.1359935562.git.richard.purdie@linuxfoundation.org
State Accepted
Commit 1c906e76432fbe9fb1ca9a41e6d309b432222d32
Headers show

Commit Message

Richard Purdie Feb. 3, 2013, 11:55 p.m.
Rather than an exec() per directory, we might as well exec one command and
be done with it.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/package.bbclass |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 6d2dd89..c822c43 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -298,11 +298,7 @@  def copydebugsources(debugsrcdir, d):
         subprocess.call(processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir), shell=True)
 
         # The copy by cpio may have resulted in some empty directories!  Remove these
-        for root, dirs, files in os.walk("%s%s" % (dvar, debugsrcdir)):
-            for d in dirs:
-                dir = os.path.join(root, d)
-                #bb.note("rmdir -p %s" % dir)
-                subprocess.call("rmdir -p %s 2>/dev/null" % dir, shell=True)
+        subprocess.call("find %s%s -empty -type d -delete" % (dvar, debugsrcdir), shell=True)
 
         # Also remove debugsrcdir if its empty
         for p in nosuchdir[::-1]: