summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2010-05-05 16:25:05 -0500
committerClark Williams <williams@redhat.com>2010-05-06 14:59:41 -0500
commit3e01be4926aa7633375779e7e9579dd055daf10d (patch)
tree4ab5a5793cd41951270f0f690a9d78dbee32deea
parent0c4254573261bd1c9144b9fd03693572eb3ba036 (diff)
downloadmock-3e01be4926aa7633375779e7e9579dd055daf10d.tar.gz
mock-3e01be4926aa7633375779e7e9579dd055daf10d.tar.xz
mock-3e01be4926aa7633375779e7e9579dd055daf10d.zip
fix yum cache synchronization problem in yum_cache.py plugin
yum made/makes an rpmdb cache dir in $cachedir/installed for a while; things can go wrong in a specific mock case if this happened. So just nuke the installed dir and the files in it. Problem solved. Signed-off-by: Clark Williams <williams@redhat.com> (cherry picked from commit 826ab6d6e04fe4e90a5700acd608c7293bdbbec9)
-rw-r--r--py/mock/plugins/yum_cache.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/py/mock/plugins/yum_cache.py b/py/mock/plugins/yum_cache.py
index 109f3e0..d2460a4 100644
--- a/py/mock/plugins/yum_cache.py
+++ b/py/mock/plugins/yum_cache.py
@@ -8,6 +8,7 @@ import logging
import fcntl
import time
import os
+import glob
# our imports
from mock.trace_decorator import decorate, traceLog, getLog
@@ -89,5 +90,13 @@ class YumCache(object):
os.unlink(fullPath)
continue
+ # so yum made an rpmdb cache dir in $cachedir/installed for a while
+ # things can go wrong in a specific mock case if this happened.
+ # So - just nuke the dir and all that's in it
+ if os.path.exists(self.yumSharedCachePath + '/installed'):
+ for fn in glob.glob(self.yumSharedCachePath + '/installed/*'):
+ os.unlink(fn)
+ os.rmdir(self.yumSharedCachePath + '/installed')
+
self._yumCachePostYumHook()