修复配置文件的更改导致出现的错误

This commit is contained in:
wangsong 2022-06-21 19:16:36 +08:00
parent bd77c9d111
commit 8386722af4
5 changed files with 101 additions and 16 deletions

View File

@ -188,7 +188,7 @@ class UpdateMsgCollector():
logging.error(e)
def Upgrade_Process_Msg(self, action, dict_msg = {}):
if self.updateManager.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False) == True:
if self.updateManager.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False) == True:
tmp_dict = {}
tmp_dict.update(dict_msg)
try:

View File

@ -212,7 +212,7 @@ class Sqlite3Server(object):
self._refresh_system_version(version)
#FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
elif pkg_list:
# 单包更新 # 获取单包数据插入数据库
pkgname = pkg_list.pop(0)
@ -262,7 +262,7 @@ class Sqlite3Server(object):
# 软件商店获取中文名
appname_cn = self.get_cn_appname(str(pkgname))
#FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
try:
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn)
# FIXME: 发送插入数据库成功的信号local_upgrade_list
@ -315,7 +315,7 @@ class Sqlite3Server(object):
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn)
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
#FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100")
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100")
# insert group deb next
for i in pkg_group:
# FIXME: 获取组信息
@ -337,7 +337,7 @@ class Sqlite3Server(object):
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
#FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100")
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100")
try:
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn)
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)

View File

@ -276,6 +276,83 @@ class UpdateList():
except Exception as e:
logging.error(e)
def _split_package_id(package):
"""Return the name, the version number and the release of the
specified package."""
if "=" in package:
name, version = package.split("=", 1)
release = None
elif "/" in package:
name, release = package.split("/", 1)
version = None
else:
name = package
version = release = None
return name, version, release
def _mark_packages_for_downgrade(self, packages, resolver):
"""Mark packages for downgrade."""
for pkg_name, pkg_ver, pkg_rel in [self._split_package_id(pkg)
for pkg in packages]:
try:
pkg = self.cache[pkg_name]
except KeyError:
pass
# raise TransactionFailed(ERROR_NO_PACKAGE,
# _("Package %s isn't available"),
# pkg_name)
if not pkg.is_installed:
pass
# raise TransactionFailed(ERROR_PACKAGE_NOT_INSTALLED,
# _("Package %s isn't installed"),
# pkg_name)
auto = pkg.is_auto_installed
if pkg_ver:
if pkg.installed and pkg.installed.version < pkg_ver:
pass
# FIXME: We need a new error enum
# raise TransactionFailed(ERROR_NO_PACKAGE,
# _("The former version %s of %s "
# "is already installed"),
# pkg.installed.version, pkg.name)
elif pkg.installed and pkg.installed.version == pkg_ver:
pass
# raise TransactionFailed(ERROR_PACKAGE_ALREADY_INSTALLED,
# _("The version %s of %s "
# "is already installed"),
# pkg.installed.version, pkg.name)
try:
pkg.candidate = pkg.versions[pkg_ver]
except KeyError:
pass
# raise TransactionFailed(ERROR_NO_PACKAGE,
# _("The version %s of %s isn't "
# "available"), pkg_ver, pkg_name)
else:
pass
# raise TransactionFailed(ERROR_NO_PACKAGE,
# _("You need to specify a version to "
# "downgrade %s to"),
# pkg_name)
# pkg.mark_install(False, False, True)
# pkg.mark_auto(auto)
# resolver.clear(pkg)
# resolver.protect(pkg)
def _make_downgrade(self,cache,data):
downgrade_pkgs = data["force_downgrade"]
for pkg_name, pkg_ver, pkg_rel in [self._split_package_id(pkg)
for pkg in downgrade_pkgs]:
try:
pkg = cache[pkg_name]
except KeyError:
logging.warning("Package %s isn't available",pkg_name)
if not pkg.is_installed:
logging.warning("Package %s isn't installed",pkg_name)
pass
def _make_groups_upgrade(self,cache,group_list, pkgs_upgrade = []):
try:
if os.path.isdir(self.parent.config_path) == False:

View File

@ -43,15 +43,17 @@ _STRINGS_ERROR = {
PRIORITY_UPGRADE_SUCCCESSED: _("Update Manager upgrade is complete, please restart the control panel before performing the system update"),
#update
ERROR_UPDATE_DEFAULT_FAILED: _("Check for update exceptions,please check your network connection and retry."),
ERROR_UPDATE_SOURCE_FAILED: _("Check for update exceptions,please check your network connection and retry."),
ERROR_NETWORK_FAILED: _("Check for update exceptions,please check your network connection and retry."),
ERROR_NOT_GROUPS_CONFIG: _("Check for update exceptions,please check your network connection and retry."),
ERROR_UPDATE_KEY_SIGNATURES: _("Check for update exceptions,please check your network connection and retry."),
ERROR_READ_IMPORTANTLIST_FAILED: _("Check for update exceptions,please check your network connection and retry."),
ERROR_SOFTWARE_INDEX_RROKEN: _("Check for update exceptions,please check your network connection and retry."),
ERROR_NOT_INIT_PACKAGESINFIO: _("Check for update exceptions,please check your network connection and retry."),
ERROR_NOT_CONFIGPKG_DEPENDENCIES: _("Check for update exceptions,please check your network connection and retry."),
ERROR_UPDATE_DEFAULT_FAILED: _("Check for update exceptions,please check your network connection."),
ERROR_UPDATE_SOURCE_FAILED: _("Check for update exceptions,please check your network connection."),
ERROR_NETWORK_FAILED: _("Check for update exceptions,please check your network connection."),
ERROR_UPDATE_KEY_SIGNATURES: _("Check for update exceptions,please check your network connection."),
ERROR_READ_IMPORTANTLIST_FAILED: _("Check for update exceptions,please check your network connection."),
ERROR_SOFTWARE_INDEX_RROKEN: _("Check for update exceptions,please check your network connection."),
ERROR_NOT_INIT_PACKAGESINFIO: _("Check for update exceptions,please check your network connection."),
#优先升级
ERROR_NOT_GROUPS_CONFIG: _("Upgrade configuration acquisition exception."),
ERROR_NOT_CONFIGPKG_DEPENDENCIES: _("Upgrade configuration acquisition exception."),
#install

View File

@ -2626,8 +2626,14 @@ 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 "Check for update exceptions,please check your network connection."
msgstr "检查更新异常,请检查您的网络连接。"
msgid "Priority upgrade status exception."
msgstr "优先升级异常。"
msgid "Upgrade configuration acquisition exception."
msgstr "升级配置获取异常。"
msgid "Please check your network connection and retry."
msgstr "请检查您的网络连接后再试。"