From 3dda6f799dd7bbb10ab212e5f4cbf30b05c6ae1d Mon Sep 17 00:00:00 2001 From: wangsong Date: Thu, 16 Jun 2022 19:12:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AF=B9=E4=BC=98=E5=85=88=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=81=9A=E5=87=BA=E4=BB=A3=E7=A0=81=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/DataAcquisition.py | 1 - backend/SystemUpdater/UpdateManager.py | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/SystemUpdater/Core/DataAcquisition.py b/backend/SystemUpdater/Core/DataAcquisition.py index af5226c..1b29758 100644 --- a/backend/SystemUpdater/Core/DataAcquisition.py +++ b/backend/SystemUpdater/Core/DataAcquisition.py @@ -19,7 +19,6 @@ import threading from email import message from binascii import a2b_hex -from datetime import datetime from Crypto.PublicKey import RSA from urllib import parse, request from PyQt5.QtCore import QSettings diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index 70e3f12..3713f67 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -315,16 +315,18 @@ class UpdateManager(): if pkg_name in cache: self_pkg = cache[pkg_name] if self_pkg.is_installed and self_pkg.is_upgradable: - logging.info("Check: Updater(%s) start upgrading From %s to %s...",pkg_name,\ + logging.info("Check: (%s) will upgrading From %s to %s...",pkg_name,\ self_pkg.installed.source_version,self_pkg.candidate.source_version) if pkg_name in important_list: try: + logging.info("Check: (%s) start upgrading From %s to %s...",pkg_name,\ + self_pkg.installed.source_version,self_pkg.candidate.source_version) self_pkg.mark_install() need_upgrade = True except SystemError: logging.error("Check: mark %s to upgrade Failed...",pkg_name) else: - logging.info("Check: (%s:%s) No need to upgrade...",pkg_name,self_pkg.installed.source_version) + logging.info("Check: (%s:%s) No need to upgrade and duo to not pust...",pkg_name,self_pkg.installed.source_version) else: logging.info("Check: (%s:%s) No need to upgrade...",pkg_name,self_pkg.installed.source_version) else: From 0eabb539129c1215a02a2b061ca8027b4a04b07d Mon Sep 17 00:00:00 2001 From: wangsong Date: Thu, 16 Jun 2022 20:34:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AF=B9=E4=BC=98=E5=85=88=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=81=9A=E5=87=BA=E4=BC=98=E5=8C=96=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=8D=87=E7=BA=A7=E6=97=B6=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E9=87=8D=E5=90=AF=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=88=96=E8=80=85=E9=87=8D=E5=90=AF=E6=8E=A7=E5=88=B6=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=A2=9E=E5=8A=A0=E6=A0=87=E5=BF=97=E4=BD=8D=E6=9D=A5?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/DataAcquisition.py | 1 + backend/SystemUpdater/Core/enums.py | 5 +- backend/SystemUpdater/UpdateManager.py | 21 +++-- .../backend/InstallBackendAptdaemon.py | 5 +- backend/SystemUpdater/backend/__init__.py | 91 ++++++++++--------- backend/data/system-updater.conf | 1 + 6 files changed, 73 insertions(+), 51 deletions(-) diff --git a/backend/SystemUpdater/Core/DataAcquisition.py b/backend/SystemUpdater/Core/DataAcquisition.py index 1b29758..7082707 100644 --- a/backend/SystemUpdater/Core/DataAcquisition.py +++ b/backend/SystemUpdater/Core/DataAcquisition.py @@ -18,6 +18,7 @@ import datetime import threading from email import message +from datetime import datetime from binascii import a2b_hex from Crypto.PublicKey import RSA from urllib import parse, request diff --git a/backend/SystemUpdater/Core/enums.py b/backend/SystemUpdater/Core/enums.py index d9bf694..55fe8f7 100644 --- a/backend/SystemUpdater/Core/enums.py +++ b/backend/SystemUpdater/Core/enums.py @@ -7,7 +7,7 @@ __all__ = ( "ERROR_NOT_INIT_PACKAGESINFIO","ERROR_READ_IMPORTANTLIST_FAILED","ERROR_RESOLVER_FAILED","ERROR_NOT_UPGRADE_PACKAGES", "ERROR_REMOVE_ESSENTIAL_PACKAGES","ERROR_NOT_DISK_SPACE", - "ERROR_UPDATE_KEY_SIGNATURES","ERROR_UPDATE_NET_AUTHENTICATION","ERROR_UPDATE_NOTREAD_SOURCES", + "ERROR_UPDATE_KEY_SIGNATURES","ERROR_UPDATE_NET_AUTHENTICATION","ERROR_UPDATE_NOTREAD_SOURCES","PRIORITY_UPGRADE_SUCCCESSED", "get_error_description_from_enum", "get_error_string_from_enum", "get_source_name_from_enum") @@ -16,6 +16,8 @@ gettext.bindtextdomain('kylin-system-updater', '/usr/share/locale') gettext.textdomain('kylin-system-updater') _ = gettext.gettext +PRIORITY_UPGRADE_SUCCCESSED = "priority-upgrade-successed" + #更新阶段 ERROR_UPDATE_KEY_SIGNATURES = "The following signatures" ERROR_UPDATE_NET_AUTHENTICATION ="does the network require authentication?" @@ -34,6 +36,7 @@ ERROR_REMOVE_ESSENTIAL_PACKAGES = "error-remove-essential-packages" ERROR_NOT_DISK_SPACE = "error-not-disk-space" _STRINGS_ERROR = { + PRIORITY_UPGRADE_SUCCCESSED: _("Update Manager upgrade is complete, please restart the control panel before performing the system update"), ERROR_UPDATE_SOURCE_FAILED: _("Unable to access the source management server"), ERROR_NETWORK_FAILED: _("Please check your network connection and retry."), ERROR_NOT_GROUPS_CONFIG: _("Unable to get group configuration package, please contact administrator to solve"), diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index 3713f67..441057c 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -306,7 +306,7 @@ class UpdateManager(): def _check_self_upgrade(self,cache): need_upgrade = False - + self_upgrade = [] with open(UpdateList.IMPORTANT_LIST_PATH, 'r') as f: data = f.read() important_list = data.split() @@ -322,6 +322,7 @@ class UpdateManager(): logging.info("Check: (%s) start upgrading From %s to %s...",pkg_name,\ self_pkg.installed.source_version,self_pkg.candidate.source_version) self_pkg.mark_install() + self_upgrade.append(pkg_name) need_upgrade = True except SystemError: logging.error("Check: mark %s to upgrade Failed...",pkg_name) @@ -340,20 +341,28 @@ class UpdateManager(): self.dbusController.UpdateDetectStatusChanged(95,_("Group configuration being updated")) logging.info("Check: groups JSON ConfigPkgs(%s) start upgrading From %s to %s...",self.GROUPS_PKG_NAME,\ pkg_json.installed.source_version,pkg_json.candidate.source_version) - pkg_json.mark_install() - need_upgrade = True + try: + pkg_json.mark_install() + self_upgrade.append(self.GROUPS_PKG_NAME) + need_upgrade = True + except SystemError: + logging.error("Check: mark %s to upgrade Failed...",pkg_name) else: logging.info("Check: ConfigPkgs(%s:%s) No need to upgrade...",self.GROUPS_PKG_NAME,pkg_json.installed.source_version) else: self.dbusController.UpdateDetectStatusChanged(95,_("Group configuration being updated")) logging.info("Check: groups JSON ConfigPkgs(%s) start new installing...",self.GROUPS_PKG_NAME) - pkg_json.mark_install() - need_upgrade = True + try: + pkg_json.mark_install() + self_upgrade.append(self.GROUPS_PKG_NAME) + need_upgrade = True + except SystemError: + logging.error("Check: mark %s to upgrade Failed...",pkg_name) else: raise UpdateBaseError(ERROR_NOT_GROUPS_CONFIG) if need_upgrade == True: - self.start_install(InstallBackend.MODE_INSTALL_SINGLE,True) + self.start_install(InstallBackend.MODE_INSTALL_SINGLE,True,upgrade_content=self_upgrade) raise UpdateProgressExit() def _check_system_broken(self,cache): diff --git a/backend/SystemUpdater/backend/InstallBackendAptdaemon.py b/backend/SystemUpdater/backend/InstallBackendAptdaemon.py index 51021ca..3b8a713 100644 --- a/backend/SystemUpdater/backend/InstallBackendAptdaemon.py +++ b/backend/SystemUpdater/backend/InstallBackendAptdaemon.py @@ -295,8 +295,7 @@ class InstallBackendAptdaemon(InstallBackend): return self.aptd_base.progress = progress - self._dist_status_changed(action,self.now_upgrade.upgrade_groups+self.now_upgrade.single_pkgs,\ - self.aptd_base.progress,self.aptd_base.status,self.aptd_base.details) + self._dist_status_changed(action,self.now_upgrade.upgrade_content,self.aptd_base.progress,self.aptd_base.status,self.aptd_base.details) #同步状态回调 @@ -309,7 +308,7 @@ class InstallBackendAptdaemon(InstallBackend): if self.aptd_base.status == None: return - self._dist_status_changed(action,self.now_upgrade.upgrade_groups+self.now_upgrade.single_pkgs,\ + self._dist_status_changed(action,self.now_upgrade.upgrade_content,\ self.aptd_base.progress,self.aptd_base.status,self.aptd_base.details) #分发进度状态和细节信息 diff --git a/backend/SystemUpdater/backend/__init__.py b/backend/SystemUpdater/backend/__init__.py index f0a61b8..68d4ad8 100644 --- a/backend/SystemUpdater/backend/__init__.py +++ b/backend/SystemUpdater/backend/__init__.py @@ -64,8 +64,12 @@ class NowUpgradeMeta: return groups_list,pkg_list def make_upgrade_content(self,content): - self.upgrade_groups,self.single_pkgs = self._make_groups_list(self.parent.upgrade_data,self.parent.action_mode,content) - self.upgrade_content = self.upgrade_groups + self.single_pkgs + if self.parent.action_mode != self.parent.MODE_INSTALL_SINGLE: + self.upgrade_groups,self.single_pkgs = self._make_groups_list(self.parent.upgrade_data,self.parent.action_mode,content) + self.upgrade_content = self.upgrade_groups + self.single_pkgs + else: + self.single_pkgs = content + self.upgrade_content = self.upgrade_groups + self.single_pkgs class AptdBaseInformation: @@ -141,9 +145,8 @@ class InstallBackend(): try: #安装升级包 首先必须调用ACTION_CHECK_RESOLVER 计算依赖解决方便 标记cache 进行升级 if self.action == self.ACTION_INSTALL or self.action == self.ACTION_DOWNLOADONLY: - if self.action_mode != self.MODE_INSTALL_SINGLE: - #拿到升级列表 - self.now_upgrade.make_upgrade_content(partial_upgrade_list) + #拿到升级列表 + self.now_upgrade.make_upgrade_content(partial_upgrade_list) pkgs_install,pkgs_upgrade,pkgs_remove = self._get_mark_from_cache(self.cache,self.upgrade_data.adjust_pkgs,self.action_mode) logging.info("INSTALL install:%d , upgrade:%d remove:%d",len(pkgs_install),len(pkgs_upgrade),len(pkgs_remove)) @@ -157,8 +160,8 @@ class InstallBackend(): if len(pkgs_install) == 0 and len(pkgs_upgrade) == 0 and len(pkgs_remove) == 0: raise UpdateBaseError(ERROR_NOT_UPGRADE_PACKAGES) - if self.action_mode == self.MODE_INSTALL_SINGLE: - logging.warning("MODE_INSTALL_SINGLE install:%s , upgrade:%s remove:%s",str(pkgs_install),str(pkgs_upgrade),str(pkgs_remove)) + # if self.action_mode == self.MODE_INSTALL_SINGLE: + # logging.warning("MODE_INSTALL_SINGLE install:%s , upgrade:%s remove:%s",str(pkgs_install),str(pkgs_upgrade),str(pkgs_remove)) self.window_main.update_essential.check(pkgs_remove) @@ -495,6 +498,45 @@ class InstallBackend(): if error_code == ERROR_NOT_DISK_SPACE: self.window_main.dbusController.InstallDetectStatus(False,error_code) + def _self_upgrade_finished(self,success,error_string='',error_desc=''): + if success: + error_string = get_error_string_from_enum(PRIORITY_UPGRADE_SUCCCESSED) + + if self.window_main.configs.getWithDefault("SystemStatus", "priority_upgrade_restart", False) == True: + if self.window_main.APTD_PKG_NAME in self.now_upgrade.upgrade_content: + self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) + self.window_main.dbusController.make_aptdeamon_restart() + + #当单包升级的时候 升级本身时,让程序退出,再重新启动 + if self.window_main.FRONTEND_PKG_NAME in self.now_upgrade.upgrade_content: + self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) + + #当单包升级的时候 升级本身时,让程序退出,再重新启动 + if self.window_main.BACKEND_PKG_NAME in self.now_upgrade.upgrade_content: + self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) + #升级本身完成后 退出 有systemd 来进行重启服务 + self.window_main.dbusController.Quit(None) + + #当单包升级的时候 升级本身时,让程序退出,再重新启动 + if self.window_main.GROUPS_PKG_NAME in self.now_upgrade.upgrade_content: + #只有安装配置文件包 才会走到此处 + self.window_main.update_essential.update() + self.window_main.start_available() + else: + #只有安装配置文件包 才会走到此处 + self.window_main.update_essential.update() + self.window_main.start_available() + return + + else: + #当更新过程中安装配置包时 失败时发送错误信号 + # 防止错误结果太长导致出现控制面板显示太多 目前最多20字符 + if len(error_string + error_desc) > 20: + self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) + else: + self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) + return + #调用aptdeamon结束之后处理的地方 不管是出错还是正常都在此处理 def _action_done(self, action, is_cancelled,success, error_string,error_desc,error_code=''): #后端的状态 到空闲状态 @@ -505,41 +547,8 @@ class InstallBackend(): self._release_install_lock() self._send_error_code(error_code) - #单包安装模式 单独处理 目前 更新配置包和升级本身使用 if self.action_mode == self.MODE_INSTALL_SINGLE: - if success: - if self.window_main.APTD_PKG_NAME in self.cache and self.cache[self.window_main.APTD_PKG_NAME] in self.cache.get_changes(): - error_string = _("Update Manager upgrade is complete, please restart the control panel before performing the system update") - self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) - self.window_main.dbusController.make_aptdeamon_restart() - - #当单包升级的时候 升级本身时,让程序退出,再重新启动 - if self.window_main.FRONTEND_PKG_NAME in self.cache and self.cache[self.window_main.FRONTEND_PKG_NAME] in self.cache.get_changes(): - error_string = _("Update Manager upgrade is complete, please restart the control panel before performing the system update") - self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) - - #当单包升级的时候 升级本身时,让程序退出,再重新启动 - if self.window_main.BACKEND_PKG_NAME in self.cache and self.cache[self.window_main.BACKEND_PKG_NAME] in self.cache.get_changes(): - error_string = _("Update Manager upgrade is complete, please restart the control panel before performing the system update") - self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) - #升级本身完成后 退出 有systemd 来进行重启服务 - self.window_main.dbusController.Quit(None) - - #当单包升级的时候 升级本身时,让程序退出,再重新启动 - if self.window_main.GROUPS_PKG_NAME in self.cache and self.cache[self.window_main.GROUPS_PKG_NAME] in self.cache.get_changes(): - #只有安装配置文件包 才会走到此处 - self.window_main.update_essential.update() - self.window_main.start_available() - - return - else: - #当更新过程中安装配置包时 失败时发送错误信号 - # 防止错误结果太长导致出现控制面板显示太多 目前最多20字符 - if len(error_string + error_desc) > 20: - self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) - else: - self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) - return + self._self_upgrade_finished() else: if self.now_upgrade.version_upgrade == True and self.now_upgrade.need_retry == True and success == False: #增加重试次数的限制 diff --git a/backend/data/system-updater.conf b/backend/data/system-updater.conf index f524e9c..2b8455d 100644 --- a/backend/data/system-updater.conf +++ b/backend/data/system-updater.conf @@ -2,6 +2,7 @@ abnormal_reboot = False close_source_filter = False upload_upgrade_log = False +priority_upgrade_restart = True [ConfigPkgStatus] check_resover_remove = False From d74c81534d377a37fc1a471b2cae6d44493ec21b Mon Sep 17 00:00:00 2001 From: wangsong Date: Thu, 16 Jun 2022 21:28:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=B9=E8=AF=8D=E6=9D=A1=E5=81=9A?= =?UTF-8?q?=E5=87=BA=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8E=A7=E5=88=B6=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=98=BE=E7=A4=BA=E7=9A=84=E5=86=85=E5=AE=B9=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E7=94=B1=E5=90=8E=E7=AB=AF=E6=8F=90=E4=BE=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/enums.py | 44 +++++++++++++--------- backend/SystemUpdater/UpdateManagerDbus.py | 3 +- backend/SystemUpdater/backend/__init__.py | 29 ++++++-------- backend/po/zh_CN.po | 9 +++-- 4 files changed, 47 insertions(+), 38 deletions(-) diff --git a/backend/SystemUpdater/Core/enums.py b/backend/SystemUpdater/Core/enums.py index 55fe8f7..dd4c0e0 100644 --- a/backend/SystemUpdater/Core/enums.py +++ b/backend/SystemUpdater/Core/enums.py @@ -3,6 +3,7 @@ """enums - Enumerates for apt daemon dbus messages""" __all__ = ( + "ERROR_UPDATE_DEFAULT_FAILED", "ERROR_UPDATE_SOURCE_FAILED","ERROR_NETWORK_FAILED","ERROR_NOT_GROUPS_CONFIG","ERROR_SOFTWARE_INDEX_RROKEN", "ERROR_NOT_INIT_PACKAGESINFIO","ERROR_READ_IMPORTANTLIST_FAILED","ERROR_RESOLVER_FAILED","ERROR_NOT_UPGRADE_PACKAGES", "ERROR_REMOVE_ESSENTIAL_PACKAGES","ERROR_NOT_DISK_SPACE", @@ -19,14 +20,16 @@ _ = gettext.gettext PRIORITY_UPGRADE_SUCCCESSED = "priority-upgrade-successed" #更新阶段 +ERROR_UPDATE_DEFAULT_FAILED = "error-update-default-failed" ERROR_UPDATE_KEY_SIGNATURES = "The following signatures" ERROR_UPDATE_NET_AUTHENTICATION ="does the network require authentication?" ERROR_UPDATE_NOTREAD_SOURCES = "The list of sources could not be read" -#自己的 ERROR_UPDATE_SOURCE_FAILED = "error-update-source-failed" ERROR_NETWORK_FAILED = "error-network-failed" ERROR_NOT_GROUPS_CONFIG = "error-not-groups-config" + +#自己的 ERROR_SOFTWARE_INDEX_RROKEN = "error-software-index-broken" ERROR_NOT_INIT_PACKAGESINFIO = "error-not-init-packagesinfo" ERROR_READ_IMPORTANTLIST_FAILED = "error-read-importantlist-failed" @@ -37,40 +40,47 @@ ERROR_NOT_DISK_SPACE = "error-not-disk-space" _STRINGS_ERROR = { PRIORITY_UPGRADE_SUCCCESSED: _("Update Manager upgrade is complete, please restart the control panel before performing the system update"), - ERROR_UPDATE_SOURCE_FAILED: _("Unable to access the source management server"), - ERROR_NETWORK_FAILED: _("Please check your network connection and retry."), - ERROR_NOT_GROUPS_CONFIG: _("Unable to get group configuration package, please contact administrator to solve"), - ERROR_SOFTWARE_INDEX_RROKEN: _("Software index is broken"), - ERROR_NOT_INIT_PACKAGESINFIO: _("Could not initialize the package information"), - ERROR_READ_IMPORTANTLIST_FAILED: _("read important list failed"), + + #update + ERROR_UPDATE_DEFAULT_FAILED: _("Check for update exceptions,please check your network connection and retry."), + ERROR_UPDATE_SOURCE_FAILED: ERROR_UPDATE_DEFAULT_FAILED, + ERROR_NETWORK_FAILED: ERROR_UPDATE_DEFAULT_FAILED, + ERROR_NOT_GROUPS_CONFIG: ERROR_UPDATE_DEFAULT_FAILED, + ERROR_UPDATE_KEY_SIGNATURES: ERROR_UPDATE_DEFAULT_FAILED, + ERROR_READ_IMPORTANTLIST_FAILED: ERROR_UPDATE_DEFAULT_FAILED, + ERROR_SOFTWARE_INDEX_RROKEN: ERROR_UPDATE_DEFAULT_FAILED, + ERROR_NOT_INIT_PACKAGESINFIO: ERROR_UPDATE_DEFAULT_FAILED, + + #install ERROR_RESOLVER_FAILED: _("Could not calculate the upgrade"), ERROR_NOT_UPGRADE_PACKAGES: _("There is an exception in the update package."), ERROR_REMOVE_ESSENTIAL_PACKAGES: _("There is an exception in the update package."), ERROR_NOT_DISK_SPACE: _("Disk space is insufficient, please clean the disk and then upgrade")} _DESCS_ERROR = { - ERROR_UPDATE_SOURCE_FAILED: _("Check your source management server config"), + #update + ERROR_UPDATE_SOURCE_FAILED: _("Unable to access the source management server"), ERROR_NETWORK_FAILED: _("Please check your network connection and retry."), - ERROR_NOT_GROUPS_CONFIG: _("groups JSON ConfigPkgs install failed"), + ERROR_UPDATE_KEY_SIGNATURES: _("Check your source public key signature"), + ERROR_UPDATE_NOTREAD_SOURCES: _("Please check your source list and retry."), + ERROR_UPDATE_NET_AUTHENTICATION: _("Check if your network requires authentication?"), + ERROR_NOT_GROUPS_CONFIG: _("Unable to get group configuration package, please contact administrator to solve."), ERROR_NOT_INIT_PACKAGESINFIO: _("An unresolvable problem occurred while " "initializing the package information.\n\n" "Please report this bug against the 'kylin-system-updater' " "package and include the following error " "message:\n"), - ERROR_SOFTWARE_INDEX_RROKEN: _("It is impossible to install or remove any software. " + ERROR_SOFTWARE_INDEX_RROKEN: _("Software index is broken") + _("It is impossible to install or remove any software. " "Please use the package manager \"Synaptic\" or run " "\"sudo apt-get install -f\" in a terminal to fix " "this issue at first."), - ERROR_READ_IMPORTANTLIST_FAILED: _("tttttttttttttttttt"), + ERROR_READ_IMPORTANTLIST_FAILED: _("read important list failed"), + + #install ERROR_RESOLVER_FAILED: _("nothing"), ERROR_NOT_UPGRADE_PACKAGES: _("This update cannot detect the upgradeable package."), ERROR_REMOVE_ESSENTIAL_PACKAGES: _("You request the removal of a system-essential package."), - ERROR_NOT_DISK_SPACE: _("test"), - ERROR_UPDATE_KEY_SIGNATURES: _("Check your source public key signature"), - ERROR_UPDATE_NET_AUTHENTICATION: _("Check if your network requires authentication?"), - - ERROR_UPDATE_NOTREAD_SOURCES: _("Please check your source list and retry.") - + ERROR_NOT_DISK_SPACE: _("test") } #UPGRADE MONITOR STATUS diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index f20e50c..3a712cf 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -66,7 +66,8 @@ class UpdateManagerDbusController(dbus.service.Object): self.parent.start_update_backend() def _update_important_error(self,retval): - self.DistUpdateDetectFinished(False,[''],get_error_string_from_enum(ERROR_UPDATE_SOURCE_FAILED),str(retval)) + logging.error(str(retval)) + self.DistUpdateDetectFinished(False,[''],get_error_string_from_enum(ERROR_UPDATE_SOURCE_FAILED)) #更新important.list的本次升级的列表 def on_update_important_list(self): diff --git a/backend/SystemUpdater/backend/__init__.py b/backend/SystemUpdater/backend/__init__.py index 68d4ad8..0c0b095 100644 --- a/backend/SystemUpdater/backend/__init__.py +++ b/backend/SystemUpdater/backend/__init__.py @@ -500,20 +500,19 @@ class InstallBackend(): def _self_upgrade_finished(self,success,error_string='',error_desc=''): if success: - error_string = get_error_string_from_enum(PRIORITY_UPGRADE_SUCCCESSED) - if self.window_main.configs.getWithDefault("SystemStatus", "priority_upgrade_restart", False) == True: + error_string = get_error_string_from_enum(PRIORITY_UPGRADE_SUCCCESSED) if self.window_main.APTD_PKG_NAME in self.now_upgrade.upgrade_content: - self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) + self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,'') self.window_main.dbusController.make_aptdeamon_restart() #当单包升级的时候 升级本身时,让程序退出,再重新启动 if self.window_main.FRONTEND_PKG_NAME in self.now_upgrade.upgrade_content: - self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) + self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,'') #当单包升级的时候 升级本身时,让程序退出,再重新启动 if self.window_main.BACKEND_PKG_NAME in self.now_upgrade.upgrade_content: - self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc) + self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,'') #升级本身完成后 退出 有systemd 来进行重启服务 self.window_main.dbusController.Quit(None) @@ -526,16 +525,9 @@ class InstallBackend(): #只有安装配置文件包 才会走到此处 self.window_main.update_essential.update() self.window_main.start_available() - return - else: - #当更新过程中安装配置包时 失败时发送错误信号 - # 防止错误结果太长导致出现控制面板显示太多 目前最多20字符 - if len(error_string + error_desc) > 20: - self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) - else: - self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) - return + default_string = get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED) + self.window_main.dbusController.DistUpdateDetectFinished(success,[],default_string,error_string +' '+error_desc) #调用aptdeamon结束之后处理的地方 不管是出错还是正常都在此处理 def _action_done(self, action, is_cancelled,success, error_string,error_desc,error_code=''): @@ -660,12 +652,14 @@ class InstallBackend(): #开始生成列表 self.window_main.start_available() else: - self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) + self.window_main.dbusController.DistUpdateDetectFinished(success,[''],\ + get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED),error_string+' '+error_desc) self.window_main.sqlite3_server.insert_into_display("check_time",get_east_8_time()) elif action == self.ACTION_UPDATE and self.action_mode == self.MODE_UPDATE_CACHE: - self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) + self.window_main.dbusController.DistUpdateDetectFinished(success,[''],\ + get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED),error_string+' '+error_desc) elif action == self.ACTION_FIX_BROKEN: self.window_main.dbusController.FixBrokenStatusChanged(True,success,100,'',error_string,error_desc) logging.warning("fix broken packages is complete...") @@ -674,7 +668,8 @@ class InstallBackend(): logging.info("Fix broken packages is complete to success...") self.window_main.start_available() else: - self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc) + self.window_main.dbusController.DistUpdateDetectFinished(success,[],\ + get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED),error_string+' '+error_desc) logging.error("fix broken packages is complete to failed...") elif action == self.ACTION_FIX_INCOMPLETE: diff --git a/backend/po/zh_CN.po b/backend/po/zh_CN.po index 3e1e070..162c127 100644 --- a/backend/po/zh_CN.po +++ b/backend/po/zh_CN.po @@ -616,8 +616,8 @@ msgid "Checking package manager" msgstr "正在检查软件包管理器" #: ../DistUpgrade/DistUpgradeController.py:1593 -msgid "Unable to get group configuration package, please contact administrator to solve" -msgstr "无法获取组配置软件包,请联系管理员解决" +msgid "Unable to get group configuration package, please contact administrator to solve." +msgstr "无法获取组配置软件包,请联系管理员解决。" #: ../DistUpgrade/DistUpgradeController.py:1594 msgid "" @@ -2599,7 +2599,7 @@ msgid "Installation failed, about to shut down" msgstr "安装失败,即将关机" msgid "groups JSON ConfigPkgs install failed" -msgstr "无法安装分组配置文件,请稍后再试" +msgstr "无法安装分组配置文件" msgid "Installtion timeout to exit Due to inactivity" msgstr "安装超时退出由于" @@ -2622,6 +2622,9 @@ msgstr "依赖关系不满足" msgid "Disk space is insufficient, please clean the disk and then upgrade" msgstr "磁盘空间不足,请清理磁盘后进行升级更新" +msgid "Check for update exceptions,please check your network connection and retry." +msgstr "检查更新异常,请检查您的网络连接后再试。" + msgid "Please check your network connection and retry." msgstr "请检查您的网络连接后再试。"