Merge branch 'backend_manual' of gitlab2.kylin.com:kylin-desktop/update-manager-group/kylin-system-updater into backend_manual

This commit is contained in:
wangsong 2022-06-18 02:56:11 +08:00
commit 63e484ac72
6 changed files with 28 additions and 39 deletions

View File

@ -104,7 +104,6 @@ class UpdateMsgCollector():
self.upgrade_list = [] self.upgrade_list = []
self.waitSendList = [] self.waitSendList = []
self.cache = None self.cache = None
self.Send_log = False
self.updateManager = manager self.updateManager = manager
# 转换 & 加密 # 转换 & 加密
self.convertor = FormatConvert(self) self.convertor = FormatConvert(self)
@ -189,7 +188,7 @@ class UpdateMsgCollector():
logging.error(e) logging.error(e)
def Upgrade_Process_Msg(self, action, dict_msg = {}): def Upgrade_Process_Msg(self, action, dict_msg = {}):
if self.Send_log == True: if self.updateManager.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False) == True:
tmp_dict = {} tmp_dict = {}
tmp_dict.update(dict_msg) tmp_dict.update(dict_msg)
try: try:
@ -218,10 +217,6 @@ class UpdateMsgCollector():
self.UploadMessage = {} self.UploadMessage = {}
self.PackageInfo = {} self.PackageInfo = {}
self.UpdateInfos = {} self.UpdateInfos = {}
def _set_Send_log(self, flag):
self.Send_log = flag
class FormatConvert(): class FormatConvert():
def __init__(self, DataCollector): def __init__(self, DataCollector):
#秘钥 #秘钥

View File

@ -30,12 +30,6 @@ class Sqlite3Server(object):
self.ucconfigs = UpgradeConfig(datadir = "/etc/kylin-version", name = "kylin-system-version.conf") self.ucconfigs = UpgradeConfig(datadir = "/etc/kylin-version", name = "kylin-system-version.conf")
self._system_version_config() self._system_version_config()
#发送日志
self.upload_upgrade_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False)
if self.upload_upgrade_log == False:
logging.warning("Log sending is not enabled, and the server will not receive your update records .")
else:
self.window_main.collector._set_Send_log(self.upload_upgrade_log)
# 初始化连接数据库 # 初始化连接数据库
def init_sqlit(self): def init_sqlit(self):
@ -218,7 +212,7 @@ class Sqlite3Server(object):
self._refresh_system_version(version) self._refresh_system_version(version)
#FIXME: 临时方案 PHP #FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100") PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
elif pkg_list: elif pkg_list:
# 单包更新 # 获取单包数据插入数据库 # 单包更新 # 获取单包数据插入数据库
pkgname = pkg_list.pop(0) pkgname = pkg_list.pop(0)
@ -268,7 +262,7 @@ class Sqlite3Server(object):
# 软件商店获取中文名 # 软件商店获取中文名
appname_cn = self.get_cn_appname(str(pkgname)) appname_cn = self.get_cn_appname(str(pkgname))
#FIXME: 临时方案 PHP #FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100") PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
try: try:
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn) self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn)
# FIXME: 发送插入数据库成功的信号local_upgrade_list # FIXME: 发送插入数据库成功的信号local_upgrade_list
@ -321,7 +315,7 @@ class Sqlite3Server(object):
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn) self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn)
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr) self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
#FIXME: 临时方案 PHP #FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100") PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100")
# insert group deb next # insert group deb next
for i in pkg_group: for i in pkg_group:
# FIXME: 获取组信息 # FIXME: 获取组信息
@ -343,7 +337,7 @@ class Sqlite3Server(object):
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)}) InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy()) self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
#FIXME: 临时方案 PHP #FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100") PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100")
try: try:
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn) self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn)
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr) self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)

View File

@ -494,7 +494,7 @@ class UpdateManagerDbusController(dbus.service.Object):
self.parent.sqlite3_server.insert_into_display("download_limit","true") self.parent.sqlite3_server.insert_into_display("download_limit","true")
self.parent.sqlite3_server.insert_into_display("download_limit_value",str(speed)) self.parent.sqlite3_server.insert_into_display("download_limit_value",str(speed))
#发送信号 #发送信号
self.DownloadSpeedChanged(str(speed)) self.ButtonStatusChange("speed" , str(speed))
return True return True
except Exception as e: except Exception as e:
logging.error(e) logging.error(e)
@ -503,11 +503,11 @@ class UpdateManagerDbusController(dbus.service.Object):
if os.path.exists("/etc/apt/apt.conf.d/80apt-download"): if os.path.exists("/etc/apt/apt.conf.d/80apt-download"):
os.remove("/etc/apt/apt.conf.d/80apt-download") os.remove("/etc/apt/apt.conf.d/80apt-download")
self.parent.sqlite3_server.insert_into_display("download_limit","false") self.parent.sqlite3_server.insert_into_display("download_limit","false")
self.DownloadSpeedChanged("0") self.ButtonStatusChange("speed", "0")
return True return True
else: else:
self.parent.sqlite3_server.insert_into_display("download_limit","false") self.parent.sqlite3_server.insert_into_display("download_limit","false")
self.DownloadSpeedChanged("0") self.ButtonStatusChange("speed", "0")
return True return True
# # dbus接口获取apt下载速度 # # dbus接口获取apt下载速度
@ -568,11 +568,16 @@ class UpdateManagerDbusController(dbus.service.Object):
try: try:
if state: if state:
self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "on", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "on", True)
self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "true")
self.ButtonStatusChange("autoUpgradeStatus", "true")
else : else :
self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "off", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "off", True)
# self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "manual", True) # self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "manual", True)
# self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "manual", True) # self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "manual", True)
self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "false")
self.ButtonStatusChange("autoUpgradeStatus", "false")
self.ChangeUpgradePolicy() self.ChangeUpgradePolicy()
except Exception as e: except Exception as e:
logging.error(str(e)) logging.error(str(e))
return False return False
@ -587,6 +592,7 @@ class UpdateManagerDbusController(dbus.service.Object):
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True)
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadTime", str(time), True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadTime", str(time), True)
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "timing", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "timing", True)
self.ButtonStatusChange("autoUpgradeTime", str(time))
elif mode == UU_UPGRADE_MODE_BEFORE_SHUTDOWN: elif mode == UU_UPGRADE_MODE_BEFORE_SHUTDOWN:
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True)
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "bshutdown", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "bshutdown", True)
@ -884,9 +890,9 @@ class UpdateManagerDbusController(dbus.service.Object):
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " RebootLogoutRequired required_status = %s",required_status)\ logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " RebootLogoutRequired required_status = %s",required_status)\
#限速修改信号 #限速修改信号
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='s') @dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='ss')
def DownloadSpeedChanged(self,limit_value=''): def ButtonStatusChange(self, signal_types = '', value=''):
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " DownloadSpeedChanged limit_value = %s",limit_value) logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " ButtonStatusChange signal_types = %s, value = %s.",signal_types, value)
# dbus 信号:用于发送立即更新信号 # dbus 信号:用于发送立即更新信号
@dbus.service.signal(UPDATER_DBUS_INTERFACE) @dbus.service.signal(UPDATER_DBUS_INTERFACE)

View File

@ -652,10 +652,8 @@ class InstallBackend():
#开始生成列表 #开始生成列表
self.window_main.start_available() self.window_main.start_available()
else: else:
self.window_main.dbusController.UpdateDetectFinished(success,[''],\ self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string+''+error_desc,error_desc)
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()[0:-4])
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: elif action == self.ACTION_UPDATE and self.action_mode == self.MODE_UPDATE_CACHE:
self.window_main.dbusController.UpdateDetectFinished(success,[''],error_string,error_desc) self.window_main.dbusController.UpdateDetectFinished(success,[''],error_string,error_desc)

View File

@ -2677,18 +2677,6 @@ msgstr "但是 %s 已经安装"
msgid "but %s is to be installed" msgid "but %s is to be installed"
msgstr "但是将要安装 %s" msgstr "但是将要安装 %s"
#. 验签提权
#. 验签失败,提权
#: ../SystemUpdater/UpdateManager.py:230
msgid ""
"Kylin System Updater requires authentication to install software packages."
msgstr "麒麟更新器安装软件包需要认证"
#: ../SystemUpdater/UpdateManagerDbus.py:421
msgid ""
"Kylin System Updater requires authentication to uninstall software packages."
msgstr "麒麟更新器卸载软件包需要认证"
#: ../SystemUpdater/Core/enums.py:763 #: ../SystemUpdater/Core/enums.py:763
msgid "Kylin System Updater" msgid "Kylin System Updater"
msgstr "麒麟更新器" msgstr "麒麟更新器"
@ -2717,3 +2705,11 @@ msgstr "卸载软件包需要认证"
#: ../SystemUpdater/UpdateManager.py:463 #: ../SystemUpdater/UpdateManager.py:463
msgid " requires authentication to install software packages." msgid " requires authentication to install software packages."
msgstr "安装软件包需要认证" msgstr "安装软件包需要认证"
#: ../SystemUpdater/Core/utils.py:750
msgid "Authentication success."
msgstr "认证成功"
#: ../SystemUpdater/Core/utils.py:753
msgid "Authentication failure."
msgstr "认证失败"

2
debian/changelog vendored
View File

@ -58,7 +58,7 @@ kylin-system-updater (2.0.1kord) v101; urgency=medium
* BUG: 无 * BUG: 无
* 需求号: 无 * 需求号: 无
* 其他改动说明: 增加开机定时下载、关机安装功能 * 其他改动说明: 增加开机定时下载、关机安装功能,仅合入代码未启用功能
* 其他改动影响域:系统更新 * 其他改动影响域:系统更新
-- luoxueyi <luoxueyi@kylinos.cn> Tue, 19 Apr 2022 17:40:34 +0800 -- luoxueyi <luoxueyi@kylinos.cn> Tue, 19 Apr 2022 17:40:34 +0800