增加dpkg 安装软件包

This commit is contained in:
wangsong 2021-12-04 14:18:17 +08:00
parent ed23d20c1b
commit 603253f1f0
1 changed files with 9 additions and 2 deletions

View File

@ -192,8 +192,15 @@ class UpdateManager():
#进行删除的操作
def start_purge_pkgs(self,pkgs_list):
try:
purge_backend = get_backend(self, InstallBackend.ACTION_REMOVE_PACKAGES)
purge_backend.start(partial_upgrade_list = pkgs_list)
# 是否有破损的包
deb_cache = Cache()
broken_count = deb_cache._depcache.broken_count
if broken_count > 0:
pkg_list_str = " ".join(pkgs_list)
return os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "-r", pkg_list_str)
else:
purge_backend = get_backend(self, InstallBackend.ACTION_REMOVE_PACKAGES)
purge_backend.start(partial_upgrade_list = pkgs_list)
except Exception as e:
logging.error(e)