deb包安装破损包执行dpkg安装

This commit is contained in:
luoxueyi 2021-12-04 14:00:34 +08:00
parent 94097fa9de
commit 1b079f06c6
1 changed files with 17 additions and 5 deletions

View File

@ -156,12 +156,24 @@ class UpdateManager():
return False,"<"+debname+"> Not a DEB package."
logging.info("About to Install Package: %s.",str(debname))
try:
dep_satisfy, header, desc = self._attempt_depends(deb_path,_check_local_dep,_auto_satisfy)
if dep_satisfy:
install_backend = get_backend(self, InstallBackend.ACTION_INSTALL_DEB)
install_backend.start_alone(partial_upgrade_list = deb_path, _is_install = _auto_satisfy)
# 是否有破损的包
deb_cache = Cache()
broken_count = deb_cache._depcache.broken_count
if broken_count > 0:
# 走 dpkg 安装流程说明本地apt环境已经损坏
try:
deb = DebPackage(filename=deb_path)
deb.install()
except Exception as e:
logging.error(str(e))
else:
self.dbusController.InstalldebFinished(dep_satisfy, header, desc)
# apt 安装流程
dep_satisfy, header, desc = self._attempt_depends(deb_path,_check_local_dep,_auto_satisfy)
if dep_satisfy:
install_backend = get_backend(self, InstallBackend.ACTION_INSTALL_DEB)
install_backend.start_alone(partial_upgrade_list = deb_path, _is_install = _auto_satisfy)
else:
self.dbusController.InstalldebFinished(dep_satisfy, header, desc)
except Exception as e:
logging.info(str(e))