From 6da80b5d6b467489492673001005321f5b506cb1 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Mon, 9 Aug 2010 17:23:13 -0500 Subject: 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 --- py/mock/backend.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'py/mock/backend.py') 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) -- cgit