The rpmdb should be auto-updating itself, guess we will find out

This commit is contained in:
harlowja
2012-08-25 23:30:19 -07:00
parent b3dca0de8a
commit 0fbb92a280
2 changed files with 11 additions and 7 deletions

View File

@@ -16,19 +16,21 @@
from anvil import shell as sh
import atexit
# See http://yum.baseurl.org/api/yum-3.2.26/yum-module.html
from yum import YumBase
from yum.packages import PackageObject
# Cache of yumbase object - 'uncached' as needed
# Cache of yumbase object
_yum_base = None
def uncache():
def _ensure_closed():
global _yum_base
if _yum_base:
# Seems like it needs to close stuff correctly...
with sh.Rooted(True):
# Seems like it needs to close stuff correctly...
del _yum_base
_yum_base = None
@@ -36,8 +38,8 @@ def uncache():
def _make_yum_base():
global _yum_base
if _yum_base is None:
_yum_base = YumBase()
_yum_base.conf.cache = False
with sh.Rooted(True):
_yum_base = YumBase()
return _yum_base
@@ -61,3 +63,6 @@ def is_adequate_installed(name, version):
if p.verGE(fake_pkg):
return True
return False
atexit.register(_ensure_closed)

View File

@@ -48,8 +48,7 @@ class YumPackager(pack.Packager):
def _execute_yum(self, cmd, **kargs):
yum_cmd = YUM_CMD + cmd
with utils.callback_on_ok(yum_helper.uncache):
return sh.execute(*yum_cmd, run_as_root=True, check_exit_code=True, **kargs)
return sh.execute(*yum_cmd, run_as_root=True, check_exit_code=True, **kargs)
def _remove_special(self, name, info):
return False