对优先升级功能缺少依赖时进行报错

This commit is contained in:
wangsong 2022-06-21 20:37:04 +08:00
parent f818cfc24f
commit 4d4111b6b0
3 changed files with 36 additions and 29 deletions

View File

@ -6,7 +6,7 @@ __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","ERROR_NOT_CONFIGPKG_DEPENDENCIES",
"ERROR_REMOVE_ESSENTIAL_PACKAGES","ERROR_NOT_DISK_SPACE","ERROR_NOT_CONFIGPKG_DEPENDENCIES","ERROR_NOT_SELFPKG_DEPENDENCIES",
"ERROR_UPDATE_KEY_SIGNATURES","ERROR_UPDATE_NET_AUTHENTICATION","ERROR_UPDATE_NOTREAD_SOURCES","PRIORITY_UPGRADE_SUCCCESSED",
@ -29,6 +29,7 @@ ERROR_UPDATE_SOURCE_FAILED = "error-update-source-failed"
ERROR_NETWORK_FAILED = "error-network-failed"
ERROR_NOT_GROUPS_CONFIG = "error-not-groups-config"
ERROR_NOT_CONFIGPKG_DEPENDENCIES = "error-not-configpkg-dependencies"
ERROR_NOT_SELFPKG_DEPENDENCIES = "error-not-selfpkg-dependencies"
#自己的
ERROR_SOFTWARE_INDEX_RROKEN = "error-software-index-broken"
@ -53,7 +54,8 @@ _STRINGS_ERROR = {
#优先升级
ERROR_NOT_GROUPS_CONFIG: _("Upgrade configuration acquisition exception."),
ERROR_NOT_CONFIGPKG_DEPENDENCIES: _("Upgrade configuration acquisition exception."),
ERROR_NOT_CONFIGPKG_DEPENDENCIES: _("Upgrade configuration acquisition exception."),
ERROR_NOT_SELFPKG_DEPENDENCIES: _("Priority upgrade status exception."),
#install
@ -81,9 +83,8 @@ _DESCS_ERROR = {
"this issue at first."),
ERROR_READ_IMPORTANTLIST_FAILED: _("read important list failed"),
ERROR_NOT_CONFIGPKG_DEPENDENCIES: _("Unable to install group configuration package, Please check the configuration package related dependencies."),
ERROR_NOT_SELFPKG_DEPENDENCIES: _("Unable to perform priority upgrade, please check the dependency related to the priority upgrade package."),
#install
ERROR_RESOLVER_FAILED: _("nothing"),
ERROR_NOT_UPGRADE_PACKAGES: _("This update cannot detect the upgradeable package."),

View File

@ -308,7 +308,7 @@ class UpdateManager():
data = f.read()
important_list = data.split()
for pkg_name in (self.BACKEND_PKG_NAME,self.APTD_PKG_NAME,self.FRONTEND_PKG_NAME):
for pkg_name in [self.BACKEND_PKG_NAME,self.APTD_PKG_NAME,self.FRONTEND_PKG_NAME]:
if pkg_name in cache:
self_pkg = cache[pkg_name]
if self_pkg.is_installed and self_pkg.is_upgradable:
@ -318,12 +318,13 @@ class UpdateManager():
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()
pkg_json.mark_install(True,False,True)
self_upgrade.append(pkg_name)
need_upgrade = True
except SystemError:
self.simulate_mode.thread_install([pkg_name])
logging.error("Check: mark %s to upgrade Failed...",pkg_name)
raise UpdateBaseError(ERROR_NOT_SELFPKG_DEPENDENCIES)
else:
logging.info("Check: (%s:%s) No need to upgrade and duo to not pust...",pkg_name,self_pkg.installed.source_version)
else:
@ -332,36 +333,38 @@ class UpdateManager():
logging.error("Check: (%s) The upgrade package is not in Cache...",pkg_name)
#config包
if self.GROUPS_PKG_NAME in cache:
pkg_json = cache[self.GROUPS_PKG_NAME]
if pkg_json.is_installed:
if pkg_json.is_upgradable:
for pkg_name in [self.GROUPS_PKG_NAME]:
if pkg_name in cache:
pkg_json = cache[pkg_name]
if pkg_json.is_installed:
if pkg_json.is_upgradable:
self.dbusController.UpdateDetectStatusChanged(95,_("Group configuration being updated"))
logging.info("Check: groups JSON ConfigPkgs(%s) start upgrading From %s to %s...",pkg_name,\
pkg_json.installed.source_version,pkg_json.candidate.source_version)
try:
pkg_json.mark_install()
self_upgrade.append(pkg_name)
need_upgrade = True
except SystemError:
logging.error("Check: mark %s to upgrade Failed...",pkg_name)
self.simulate_mode.thread_install([pkg_name])
raise UpdateBaseError(ERROR_NOT_CONFIGPKG_DEPENDENCIES)
else:
logging.info("Check: ConfigPkgs(%s:%s) No need to upgrade...",pkg_name,pkg_json.installed.source_version)
else:
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)
logging.info("Check: groups JSON ConfigPkgs(%s) start new installing...",pkg_name)
try:
pkg_json.mark_install()
self_upgrade.append(self.GROUPS_PKG_NAME)
pkg_json.mark_install(True,False,True)
self_upgrade.append(pkg_name)
need_upgrade = True
except SystemError:
logging.error("Check: mark %s to install Failed...",pkg_name)
self.simulate_mode.thread_install([pkg_name])
logging.error("Check: mark %s to upgrade Failed...",pkg_name)
raise UpdateBaseError(ERROR_NOT_CONFIGPKG_DEPENDENCIES)
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)
try:
pkg_json.mark_install()
self_upgrade.append(self.GROUPS_PKG_NAME)
need_upgrade = True
except SystemError:
self.simulate_mode.thread_install([pkg_name])
logging.error("Check: mark %s to install Failed...",pkg_name)
raise UpdateBaseError(ERROR_NOT_CONFIGPKG_DEPENDENCIES)
else:
raise UpdateBaseError(ERROR_NOT_GROUPS_CONFIG)
logging.error("Check: groups JSON ConfigPkgs(%s) is not in Cache...",pkg_name)
raise UpdateBaseError(ERROR_NOT_GROUPS_CONFIG)
if need_upgrade == True:
self.start_install(InstallBackend.MODE_INSTALL_SINGLE,True,upgrade_content=self_upgrade)

View File

@ -623,6 +623,9 @@ msgstr "无法获取组配置软件包,请检查组配置包是否存在软件
msgid "Unable to install group configuration package, Please check the configuration package related dependencies."
msgstr "无法安装组配置包,请检查组配置包相关依赖。"
msgid "Unable to perform priority upgrade, please check the dependency related to the priority upgrade package."
msgstr "无法进行优先升级,请检查优先升级包相关依赖。"
#: ../DistUpgrade/DistUpgradeController.py:1594
msgid ""
"Preparing the system for the upgrade failed so a bug reporting process is "