From 03c8b38c3105273db9b6c1de21eba6a5790c7ade Mon Sep 17 00:00:00 2001 From: wangsong Date: Mon, 26 Sep 2022 16:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A1=E7=AE=97=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E7=9A=84=E8=BF=87=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/backend/__init__.py | 28 +++++++---------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/backend/SystemUpdater/backend/__init__.py b/backend/SystemUpdater/backend/__init__.py index e3d12db..413d24b 100644 --- a/backend/SystemUpdater/backend/__init__.py +++ b/backend/SystemUpdater/backend/__init__.py @@ -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 = ''