summaryrefslogtreecommitdiffstats
path: root/py/mock/backend.py
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2010-08-09 17:23:13 -0500
committerClark Williams <williams@redhat.com>2010-08-12 15:06:13 -0500
commit6da80b5d6b467489492673001005321f5b506cb1 (patch)
tree79840c152fb70e5772d2ef1e6a4eed90f85b08a5 /py/mock/backend.py
parent59020475e4b76f324298a6c719b55f7435d33ac9 (diff)
downloadmock-6da80b5d6b467489492673001005321f5b506cb1.tar.gz
mock-6da80b5d6b467489492673001005321f5b506cb1.tar.xz
mock-6da80b5d6b467489492673001005321f5b506cb1.zip
pass selinux status to mock.util.rmtree() function (BZ# 614440)
Pass in boolean 'selinux' via keyword arguments that tells rmtree whether to do retry logic with selinux attributes Signed-off-by: Clark Williams <williams@redhat.com>
Diffstat (limited to 'py/mock/backend.py')
-rw-r--r--py/mock/backend.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/py/mock/backend.py b/py/mock/backend.py
index 9fbfbea..c7d0ca9 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -138,7 +138,7 @@ class Root(object):
self.tryLockBuildRoot()
self.state("clean")
self._callHooks('clean')
- mock.util.rmtree(self.basedir)
+ mock.util.rmtree(self.basedir, selinux=self.selinux)
self.chrootWasCleaned = True
decorate(traceLog())
@@ -149,20 +149,20 @@ class Root(object):
self._callHooks('clean')
for scrub in scrub_opts:
if scrub == 'all':
- mock.util.rmtree(self.basedir)
+ mock.util.rmtree(self.basedir, selinux=self.selinux)
self.chrootWasCleaned = True
- mock.util.rmtree(self.cachedir)
+ mock.util.rmtree(self.cachedir, selinux=self.selinux)
elif scrub == 'chroot':
- mock.util.rmtree(self.basedir)
+ mock.util.rmtree(self.basedir, selinux=self.selinux)
self.chrootWasCleaned = True
elif scrub == 'cache':
- mock.util.rmtree(self.cachedir)
+ mock.util.rmtree(self.cachedir, selinux=self.selinux)
elif scrub == 'c-cache':
- mock.util.rmtree(os.path.join(self.cachedir, 'ccache'))
+ mock.util.rmtree(os.path.join(self.cachedir, 'ccache'), selinux=self.selinux)
elif scrub == 'root-cache':
- mock.util.rmtree(os.path.join(self.cachedir, 'root_cache'))
+ mock.util.rmtree(os.path.join(self.cachedir, 'root_cache'), selinux=self.selinux)
elif scrub == 'yum-cache':
- mock.util.rmtree(os.path.join(self.cachedir, 'yum_cache'))
+ mock.util.rmtree(os.path.join(self.cachedir, 'yum_cache'), selinux=self.selinux)
decorate(traceLog())
def tryLockBuildRoot(self):
@@ -336,7 +336,7 @@ class Root(object):
decorate(traceLog())
def _setupDev(self):
# files in /dev
- mock.util.rmtree(self.makeChrootPath("dev"))
+ mock.util.rmtree(self.makeChrootPath("dev"), selinux=self.selinux)
mock.util.mkdirIfAbsent(self.makeChrootPath("dev", "pts"))
mock.util.mkdirIfAbsent(self.makeChrootPath("dev", "shm"))
prevMask = os.umask(0000)
@@ -669,7 +669,7 @@ class Root(object):
raise mock.exception.RootError, "Could not find useradd in chroot, maybe the install failed?"
# safe and easy. blow away existing /builddir and completely re-create.
- mock.util.rmtree(self.makeChrootPath(self.homedir))
+ mock.util.rmtree(self.makeChrootPath(self.homedir), selinux=self.selinux)
dets = { 'uid': str(self.chrootuid), 'gid': str(self.chrootgid), 'user': self.chrootuser, 'group': self.chrootgroup, 'home': self.homedir }
self.doChroot(['/usr/sbin/userdel', '-r', dets['user']], shell=False, raiseExc=False)