diff options
Diffstat (limited to 'py/mock/plugins/root_cache.py')
-rw-r--r-- | py/mock/plugins/root_cache.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/py/mock/plugins/root_cache.py b/py/mock/plugins/root_cache.py index 8756c01..ffed12e 100644 --- a/py/mock/plugins/root_cache.py +++ b/py/mock/plugins/root_cache.py @@ -109,11 +109,18 @@ class RootCache(object): # never rebuild cache unless it was a clean build. if self.rootObj.chrootWasCleaned: + mock.util.do(["sync"], shell=False) self.state("creating cache") - mock.util.do( - ["tar"] + self.compressArgs + ["-cf", self.rootCacheFile, - "-C", self.rootObj.makeChrootPath(), "."], - shell=False - ) + try: + mock.util.do( + ["tar"] + self.compressArgs + ["-cf", self.rootCacheFile, + "-C", self.rootObj.makeChrootPath(), + "."], + shell=False + ) + except: + if os.path.exists(self.rootCacheFile): + os.remove(self.rootCacheFile) + raise finally: self._rootCacheUnlock() |