From c1bad8c5fcd9fc5502cd8d8c8de38b7190806f72 Mon Sep 17 00:00:00 2001
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Date: Mon, 7 Jun 2010 13:06:04 +0200
Subject: [PATCH 7/7] Use utils.prunedir()

.. instead of os.system("rm -rf")

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 lib/bb/build.py          |    2 +-
 lib/bb/fetch/bzr.py      |    2 +-
 lib/bb/fetch/perforce.py |    2 +-
 lib/bb/fetch/svk.py      |    2 +-
 lib/bb/utils.py          |    1 +
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 7bb0f49..4844c10 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -102,7 +102,7 @@ def exec_func(func, d, dirs = None):
     cleandirs = flags['cleandirs']
     if cleandirs:
         for cdir in data.expand(cleandirs, d).split():
-            os.system("rm -rf %s" % cdir)
+            bb.utils.prunedir(cdir)
 
     if dirs is None:
         dirs = flags['dirs']
diff --git a/lib/bb/fetch/bzr.py b/lib/bb/fetch/bzr.py
index 813d7d8..37225ab 100644
--- a/lib/bb/fetch/bzr.py
+++ b/lib/bb/fetch/bzr.py
@@ -97,7 +97,7 @@ class Bzr(Fetch):
             os.chdir(os.path.join (ud.pkgdir, os.path.basename(ud.path)))
             runfetchcmd(bzrcmd, d)
         else:
-            os.system("rm -rf %s" % os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir)))
+            bb.utils.prunedir(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir)))
             bzrcmd = self._buildbzrcommand(ud, d, "fetch")
             bb.msg.debug(1, bb.msg.domain.Fetcher, "BZR Checkout %s" % loc)
             bb.mkdirhier(ud.pkgdir)
diff --git a/lib/bb/fetch/perforce.py b/lib/bb/fetch/perforce.py
index 5b6c601..862b077 100644
--- a/lib/bb/fetch/perforce.py
+++ b/lib/bb/fetch/perforce.py
@@ -204,4 +204,4 @@ class Perforce(Fetch):
                 pass
             raise FetchError(module)
         # cleanup
-        os.system('rm -rf %s' % tmpfile)
+        bb.utils.prunedir(tmpfile)
diff --git a/lib/bb/fetch/svk.py b/lib/bb/fetch/svk.py
index a17ac04..5e9afe3 100644
--- a/lib/bb/fetch/svk.py
+++ b/lib/bb/fetch/svk.py
@@ -103,4 +103,4 @@ class Svk(Fetch):
                 pass
             raise FetchError(ud.module)
         # cleanup
-        os.system('rm -rf %s' % tmpfile)
+        bb.utils.prunedir(tmpfile)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index a582ad3..1a79ade 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -500,6 +500,7 @@ def build_environment(d):
         if export:
             os.environ[var] = bb.data.getVar(var, d, True) or ""
 
+# ??? shutil.rmtree() ?
 def prunedir(topdir):
     # Delete everything reachable from the directory named in 'topdir'.
     # CAUTION:  This is dangerous!
-- 
1.7.1

