优化计算删除软件包
This commit is contained in:
parent
ff8c711952
commit
675e5ab451
|
@ -10,6 +10,7 @@ import json
|
|||
import logging
|
||||
import subprocess
|
||||
import traceback
|
||||
import threading
|
||||
from apt import Cache
|
||||
from gettext import gettext as _
|
||||
from SystemUpdater.Core.errors import *
|
||||
|
@ -288,6 +289,10 @@ class InstallBackend():
|
|||
self.window_main.dbusController.DistupgradeDependResloveStatus(True,is_remove_pkgs,pkgs_remove,raw_description,delete_desc,'','')
|
||||
|
||||
self._action_done(self.action,False,True,'','')
|
||||
|
||||
if is_remove_pkgs:
|
||||
threading_emulate = threading.Thread(target=self._emulate_calcul_delete,args=((pkgs_upgrade + pkgs_install),))
|
||||
threading_emulate.start()
|
||||
|
||||
#修复未满足的依赖关系 与apt-get -f install匹配
|
||||
elif self.action == self.ACTION_CHECK_BROKEN:
|
||||
|
@ -547,9 +552,6 @@ class InstallBackend():
|
|||
logging.info("ProblemResolver install:%d , upgrade:%d",len(pkgs_install),len(pkgs_upgrade))
|
||||
logging.info("Start calculating dependencies...")
|
||||
|
||||
if self.window_main.configs_cover.getWithDefault("ConfigPkgStatus", "check_resover_remove", False) == True:
|
||||
self._emulate_calcul_delete(cache,pkgs_upgrade + pkgs_install)
|
||||
|
||||
#actiongroup 可以加速计算依赖关系 计算花费的时间将大幅度缩减
|
||||
with cache.actiongroup():
|
||||
if cache.get_changes():
|
||||
|
@ -596,13 +598,22 @@ class InstallBackend():
|
|||
raise UpdateBaseError(ERROR_RESOLVER_FAILED,
|
||||
desc= terminal_msg)
|
||||
|
||||
def _emulate_calcul_delete(self,cache,total_pkg,):
|
||||
logging.info("Start calculating delete dependencies...")
|
||||
def _emulate_calcul_delete(self,total_pkg):
|
||||
# 多线程的方式来计算删除的软件包
|
||||
logging.info("[DELETE_DETAILS] Start calculating delete dependencies...")
|
||||
delete_pkgs = []
|
||||
last_delete_count = 0
|
||||
cache = Cache()
|
||||
|
||||
with cache.actiongroup():
|
||||
if cache.get_changes():
|
||||
cache.clear()
|
||||
for pkg in total_pkg:
|
||||
if '#' in pkg:
|
||||
pkg = pkg.split("#")[0]
|
||||
elif '=' in pkg:
|
||||
pkg = pkg.split("=")[0]
|
||||
|
||||
try:
|
||||
cache[pkg].mark_install()
|
||||
except Exception as e:
|
||||
|
@ -615,7 +626,10 @@ class InstallBackend():
|
|||
if pkg_obj.marked_delete and pkg_obj.name not in delete_pkgs:
|
||||
delete_pkgs.append(pkg_obj.name)
|
||||
delete_pkgs.append(pkg)
|
||||
logging.warning("%s Will be deleted Due to Install or Upgrade %s",pkg_obj.name,pkg)
|
||||
logging.info("[DELETE_DETAILS] %s Will be deleted Due to Install or Upgrade %s",pkg_obj.name,pkg)
|
||||
|
||||
logging.info("[DELETE_DETAILS] End calculating delete dependencies...")
|
||||
cache.close()
|
||||
|
||||
def _send_error_code(self,error_code):
|
||||
if error_code == ERROR_NOT_DISK_SPACE:
|
||||
|
|
|
@ -10,4 +10,5 @@ key8 = /usr/bin/kylin-unattended-upgrade
|
|||
key9 = /usr/bin/kylin-software-center
|
||||
key10 = /usr/bin/kylin-printer
|
||||
key11 = /usr/bin/kylin-printer-applet
|
||||
key12 = /usr/bin/hedron-client
|
||||
key12 = /usr/bin/hedron-client
|
||||
key13 = /usr/bin/kylin-software-center-plugin-synchrodata
|
Loading…
Reference in New Issue