我有RHEL 7.2 box
,这是我的情景:
我有2个用例,其中一个是工作,第二个是不工作
rocksdb.x86_64 3.10.0-11.el7 rocksdb-devel.x86_64 3.10.0-11.el7
我正在将此包传递给install
函数:rocksdb-devel-3.10.0-8.el7.x86_64
,它应该带来依赖项(rocksdb-3.10.0-8.el7.x86_64)
我将相同的包传递给install
函数。
Here's a snippet of my code:
class YumYum(object):
installed_packages = None
def init (自我): self.yb = yum.YumBase() self.yb.conf.assumeyes = True #self.yb.conf.cache = 1 #self.yb.setCacheDir() self.non_devel_packages = [] self._probe_installed_packages()
def _probe_installed_packages(self):
inst = self.yb.rpmdb.returnPackages()
self.installed_packages = [
Package(
x.name,
x.version,
x.release,
strict=False) for x in inst]
def _execute(self):
message(OKGREEN, "Performing cleanup...")
self._cleanup()
message(OKGREEN, "After cleanup")
self.yb.resolveDeps()
self.yb.buildTransaction()
self.yb.processTransaction()
def _cleanup(self):
self.yb.cleanRpmDB()
self.yb.cleanExpireCache()
self.yb.cleanMetadata()
self.yb.cleanSqlite()
self.yb.cleanPackages()
def install(self, package)
self.yb.install(
name=pkg.name, version=str(
pkg.version), release=str(
pkg.release), arch="x86_64")
self._execute()
def remove(self, package)
self.yb.remove(name=pkg.name, version=str(pkg.version))
self._execute()
# Main
yumyum = YumYum()
yumyum.remove(package) # In my real code the remove won't be called if i haven't found any packages to be removed (I.E if i haven't found a new newer packaged which is currently installed than needed)
yumyum.install(package)
在第一个方案中正在删除软件包,但安装失败,出现此异常:
File "./pd-build.py", line 617, in _execute
self.yb.processTransaction()
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 6503, in processTransaction
self._doTestTransaction(callback,display=rpmTestDisplay)
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 6582, in _doTestTransaction
raise Errors.YumRPMCheckError,retmsgs
yum.Errors.YumRPMCheckError: [u'ERROR with transaction check vs depsolve:', 'rocksdb(x86-64) = 3.10.0-8.el7 is needed by rocksdb-devel-3.10.0-8.el7.x86_64']
在第二个方面:它正在执行安装,没有任何错误。
因此,为了尝试重现错误(在第一个场景中),我使用yum cli
执行了相同的命令,并设法删除并安装所有内容。
我想知道我是否遗漏了YumBase类或其他内容中的任何配置。