优化计算依赖的过程

This commit is contained in:
wangsong 2022-09-26 16:34:31 +08:00
parent df28440665
commit 03c8b38c31
1 changed files with 8 additions and 20 deletions

View File

@ -234,8 +234,6 @@ class InstallBackend():
delete_pkgs = []
#被删除包的描述
raw_description = []
#那些包升级导致删除包 全盘升级不包含
delete_desc = []
#判断是否配置aptdaemon的限速
self.window_main.check_conifg_aptdeamon()
@ -246,16 +244,10 @@ class InstallBackend():
#获取要升级和安装的包列表
pkgs_install,pkgs_upgrade = self._make_pkgs_list(self.cache,self.upgrade_data.groups_pkgs,self.now_upgrade.upgrade_groups,self.now_upgrade.single_pkgs)
#计算解决依赖关系
delete_pkgs,delete_desc = self._make_problem_resolver(self.cache,pkgs_install,pkgs_upgrade,self.upgrade_data.adjust_pkgs)
self._make_problem_resolver(self.cache,pkgs_install,pkgs_upgrade,self.upgrade_data.adjust_pkgs)
pkgs_install,pkgs_upgrade,pkgs_remove,pkgs_downgrade = self._get_mark_from_cache(self.cache,self.upgrade_data.adjust_pkgs,self.action_mode)
if len(pkgs_remove) != len(delete_pkgs):
logging.warning("Simulation of the deletion package list:%s",str(delete_pkgs))
logging.warning("ProblemResolver of the deletion package list:%s",str(pkgs_remove))
delete_desc = []
self.update_essential.check_white(pkgs_remove)
else:
pkgs_remove = delete_pkgs
self.update_essential.check_white(pkgs_remove)
else:
# 使用全盘升级 全盘使用dist-upgrade
if self.cache.get_changes():
@ -267,21 +259,20 @@ class InstallBackend():
len(pkgs_remove),len(pkgs_downgrade))
is_remove_pkgs = len(pkgs_remove) != 0
# 数据上报
self.window_main.collector.Generate_Msg(self.now_upgrade.upgrade_groups+self.now_upgrade.single_pkgs, self.action_mode)
errorCode = ""
if is_remove_pkgs:
errorCode = _("Need remove pkgs: ")+", ".join(pkgs_remove)
for ul in self.window_main.collector.upgrade_list:
self.window_main.collector.Upgrade_Process_Msg(self.action, {"appname":ul, "status":is_remove_pkgs, "errorCode":errorCode})
#添加关于删除包的描述信息
#补充删除包的描述信息,删除描述
delete_desc = []
for pkg in pkgs_remove:
pkg_obj = self.cache[pkg]
raw_description.append(getattr(pkg_obj.candidate, "summary", ''))
#补充删除描述
if pkgs_remove != [] and delete_desc == []:
for pkg in pkgs_remove:
delete_desc.append('')
delete_desc.append('')
if self.action_mode != self.MODE_INSTALL_SYSTEM:
self.window_main.dbusController.UpdateDependResloveStatus(True,is_remove_pkgs,pkgs_remove,raw_description,delete_desc,'','')
@ -545,9 +536,6 @@ class InstallBackend():
#将获取本次升级的包 进行计算依赖关系 解决依赖问题
def _make_problem_resolver(self,cache,pkgs_install = [],pkgs_upgrade = [],adjust_pkgs = []):
#计算出来的需要删除的包列表
delete_pkgs = []
delete_desc = []
try:
logging.info("ProblemResolver install:%d , upgrade:%d",len(pkgs_install),len(pkgs_upgrade))
logging.info("Start calculating dependencies...")
@ -586,7 +574,7 @@ class InstallBackend():
resolver.protect(pkg_cache)
resolver.resolve()
return delete_pkgs,delete_desc
return
except Exception as e:
logging.error(str(e))
pkg_string = ''