优化计算依赖的过程
This commit is contained in:
parent
df28440665
commit
03c8b38c31
|
@ -234,8 +234,6 @@ class InstallBackend():
|
||||||
delete_pkgs = []
|
delete_pkgs = []
|
||||||
#被删除包的描述
|
#被删除包的描述
|
||||||
raw_description = []
|
raw_description = []
|
||||||
#那些包升级导致删除包 全盘升级不包含
|
|
||||||
delete_desc = []
|
|
||||||
|
|
||||||
#判断是否配置aptdaemon的限速
|
#判断是否配置aptdaemon的限速
|
||||||
self.window_main.check_conifg_aptdeamon()
|
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)
|
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)
|
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):
|
self.update_essential.check_white(pkgs_remove)
|
||||||
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
|
|
||||||
else:
|
else:
|
||||||
# 使用全盘升级 全盘使用dist-upgrade
|
# 使用全盘升级 全盘使用dist-upgrade
|
||||||
if self.cache.get_changes():
|
if self.cache.get_changes():
|
||||||
|
@ -267,21 +259,20 @@ class InstallBackend():
|
||||||
len(pkgs_remove),len(pkgs_downgrade))
|
len(pkgs_remove),len(pkgs_downgrade))
|
||||||
is_remove_pkgs = len(pkgs_remove) != 0
|
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)
|
self.window_main.collector.Generate_Msg(self.now_upgrade.upgrade_groups+self.now_upgrade.single_pkgs, self.action_mode)
|
||||||
errorCode = ""
|
errorCode = ""
|
||||||
if is_remove_pkgs:
|
if is_remove_pkgs:
|
||||||
errorCode = _("Need remove pkgs: ")+", ".join(pkgs_remove)
|
errorCode = _("Need remove pkgs: ")+", ".join(pkgs_remove)
|
||||||
for ul in self.window_main.collector.upgrade_list:
|
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})
|
self.window_main.collector.Upgrade_Process_Msg(self.action, {"appname":ul, "status":is_remove_pkgs, "errorCode":errorCode})
|
||||||
|
|
||||||
#添加关于删除包的描述信息
|
#补充删除包的描述信息,删除描述
|
||||||
|
delete_desc = []
|
||||||
for pkg in pkgs_remove:
|
for pkg in pkgs_remove:
|
||||||
pkg_obj = self.cache[pkg]
|
pkg_obj = self.cache[pkg]
|
||||||
raw_description.append(getattr(pkg_obj.candidate, "summary", ''))
|
raw_description.append(getattr(pkg_obj.candidate, "summary", ''))
|
||||||
#补充删除描述
|
delete_desc.append('')
|
||||||
if pkgs_remove != [] and delete_desc == []:
|
|
||||||
for pkg in pkgs_remove:
|
|
||||||
delete_desc.append('')
|
|
||||||
|
|
||||||
if self.action_mode != self.MODE_INSTALL_SYSTEM:
|
if self.action_mode != self.MODE_INSTALL_SYSTEM:
|
||||||
self.window_main.dbusController.UpdateDependResloveStatus(True,is_remove_pkgs,pkgs_remove,raw_description,delete_desc,'','')
|
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 = []):
|
def _make_problem_resolver(self,cache,pkgs_install = [],pkgs_upgrade = [],adjust_pkgs = []):
|
||||||
#计算出来的需要删除的包列表
|
|
||||||
delete_pkgs = []
|
|
||||||
delete_desc = []
|
|
||||||
try:
|
try:
|
||||||
logging.info("ProblemResolver install:%d , upgrade:%d",len(pkgs_install),len(pkgs_upgrade))
|
logging.info("ProblemResolver install:%d , upgrade:%d",len(pkgs_install),len(pkgs_upgrade))
|
||||||
logging.info("Start calculating dependencies...")
|
logging.info("Start calculating dependencies...")
|
||||||
|
@ -586,7 +574,7 @@ class InstallBackend():
|
||||||
resolver.protect(pkg_cache)
|
resolver.protect(pkg_cache)
|
||||||
|
|
||||||
resolver.resolve()
|
resolver.resolve()
|
||||||
return delete_pkgs,delete_desc
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(str(e))
|
logging.error(str(e))
|
||||||
pkg_string = ''
|
pkg_string = ''
|
||||||
|
|
Loading…
Reference in New Issue