summaryrefslogtreecommitdiffstats
path: root/py/mock/plugins/root_cache.py
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2008-01-20 13:30:41 -0600
committerMichael E Brown <michael_e_brown@dell.com>2008-01-20 13:30:41 -0600
commit5aaa59800cae18440c1ba6caca5800e45b3ff5fa (patch)
tree5ff0a59f1718f0afca5bcaa1f88bb9dd383e001c /py/mock/plugins/root_cache.py
parent7589279b856ae73eb26fc728a38a58edbe06d94c (diff)
downloadmock-5aaa59800cae18440c1ba6caca5800e45b3ff5fa.tar.gz
mock-5aaa59800cae18440c1ba6caca5800e45b3ff5fa.tar.xz
mock-5aaa59800cae18440c1ba6caca5800e45b3ff5fa.zip
convert mock.util.do() to use subprocess.Popen() rather than raw fork/exec.\nThis cleans up the code considerably. Also, start reducing the places where we use a shell in the subcommand.
Diffstat (limited to 'py/mock/plugins/root_cache.py')
-rw-r--r--py/mock/plugins/root_cache.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/py/mock/plugins/root_cache.py b/py/mock/plugins/root_cache.py
index bfcec31..7bae43f 100644
--- a/py/mock/plugins/root_cache.py
+++ b/py/mock/plugins/root_cache.py
@@ -74,7 +74,10 @@ class RootCache(object):
if os.path.exists(self.rootCacheFile) and self.rootObj.chrootWasCleaned:
self.state("unpacking root cache")
self._rootCacheLock()
- mock.util.do("tar xzf %s -C %s" % (self.rootCacheFile, self.rootObj.makeChrootPath()))
+ mock.util.do(
+ ["tar", "xzf", self.rootCacheFile, "-C", self.rootObj.makeChrootPath()],
+ shell=False
+ )
self._rootCacheUnlock()
self.chroot_setup_cmd = "update"
self.rootObj.chrootWasCleaned = False
@@ -85,6 +88,9 @@ class RootCache(object):
if self.rootObj.chrootWasCleaned:
self.state("creating cache")
self._rootCacheLock(shared=0)
- mock.util.do("tar czf %s -C %s ." % (self.rootCacheFile, self.rootObj.makeChrootPath()))
+ mock.util.do(
+ ["tar", "czf", self.rootCacheFile, "-C", self.rootObj.makeChrootPath()],
+ shell=False
+ )
self._rootCacheUnlock()