diff --git a/yum/__init__.py b/yum/__init__.py
index 6378cdc..cc57e98 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -427,6 +427,9 @@ class YumBase(depsolve.Depsolve):
def closeRpmDB(self):
"""closes down the instances of the rpmdb we have wangling around"""
+ if self._rpmdb is not None:
+ self._rpmdb.ts = None
+ self._rpmdb.dropCachedData()
self._rpmdb = None
self._ts = None
self._tsInfo = None
@@ -1008,6 +1011,7 @@ class YumBase(depsolve.Depsolve):
# for any kind of install add from_repo to the yumdb, and the cmdline
# and the install reason
+ self.rpmdb.dropCachedData()
for txmbr in self.tsInfo:
if txmbr.output_state in TS_INSTALL_STATES:
if not self.rpmdb.contains(po=txmbr.po):
@@ -1037,7 +1041,7 @@ class YumBase(depsolve.Depsolve):
else:
self.verbose_logger.log(logginglevels.DEBUG_2, 'What is this? %s' % txmbr.po)
-
+ self.rpmdb.dropCachedData()
def costExcludePackages(self):
"""exclude packages if they have an identical package in another repo
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 5189b18..8556e9a 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -140,7 +140,10 @@ class RPMDBPackageSack(PackageSackBase):
self._simple_pkgtup_list = []
self._get_pro_cache = {}
self._get_req_cache = {}
- misc.unshare_data()
+ # We can be called on python shutdown (due to yb.__del__), at which
+ # point other modules might not be available.
+ if misc is not None:
+ misc.unshare_data()
self._cache = {
'provides' : { },
'requires' : { },