From 994b545a221c9a5f1be762abf332d94256cc6386 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 24 Dec 2021 15:05:07 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E7=9A=84=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManager.py | 2 ++ backend/SystemUpdater/UpdateManagerDbus.py | 11 +++------- .../backend/InstallBackendAptdaemon.py | 21 ++++++++++++++----- backend/kylin-system-updater | 20 +++++++++--------- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index 3b3b667..d8db7d3 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -56,6 +56,8 @@ class UpdateManager(): #数据采集器 self.collector = UpdateMsgCollector(self) + self.aptdaemonLang = os.environ["LANGUAGE"] + #检查是否需要重新启动aptdeamon 目前需要重启的有限速功能 def restart_aptdeamon(self): diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index caade17..6a11d13 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -149,14 +149,9 @@ class UpdateManagerDbusController(dbus.service.Object): @dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='s',out_signature='i') def GetBackendStatus(self,user_lang): try: - # if user_lang not in os.environ["LANG"]: - # 如果系统不是中文也不是英文 就默认中文 - # if user_lang != "en" and user_lang != "zh_CN:en": - # logging.error("%s",user_lang) - # user_lang = "zh_CN:en" - - # logging.warning("The system language is switched %s to %s",os.environ["LANGUAGE"],user_lang) - # os.environ["LANGUAGE"] = user_lang + if user_lang != os.environ["LANGUAGE"]: + logging.warning("The system language is switched %s to %s",os.environ["LANGUAGE"],user_lang) + os.environ["LANGUAGE"] = user_lang #处于更新和升级中的话 不进行更新 logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' GetBackendStatus ...') diff --git a/backend/SystemUpdater/backend/InstallBackendAptdaemon.py b/backend/SystemUpdater/backend/InstallBackendAptdaemon.py index 95757e4..04f98e5 100644 --- a/backend/SystemUpdater/backend/InstallBackendAptdaemon.py +++ b/backend/SystemUpdater/backend/InstallBackendAptdaemon.py @@ -7,6 +7,8 @@ from gettext import gettext as _ from SystemUpdater.Core.utils import humanize_size import dbus,time from gi.repository import GLib +import os +from importlib import reload # 超时检测 秒单位 UPDATER_IDLE_CHECK_INTERVAL = 10 @@ -22,16 +24,25 @@ class InstallBackendAptdaemon(InstallBackend): def __init__(self, window_main, action): InstallBackend.__init__(self, window_main, action) self.window_main = window_main - - from aptdaemon import client - from aptdaemon import errors - from aptdaemon.enums import (EXIT_SUCCESS, + import aptdaemon.client as client + import aptdaemon.errors as errors + import aptdaemon.enums as enums + from aptdaemon.enums import ( + EXIT_SUCCESS, EXIT_FAILED, EXIT_CANCELLED, get_error_description_from_enum, get_error_string_from_enum, get_status_string_from_enum ) + #切换aptdaemon的语言 重新导入模块就可以进行切换 + if os.environ["LANGUAGE"] != self.window_main.aptdaemonLang: + logging.warning("Aptdeamon language is switched %s to %s",self.window_main.aptdaemonLang,os.environ["LANGUAGE"]) + self.window_main.aptdaemonLang = os.environ["LANGUAGE"] + reload(client) + reload(errors) + reload(enums) + self.errors = errors self.EXIT_SUCCESS = EXIT_SUCCESS self.EXIT_FAILED = EXIT_FAILED @@ -377,7 +388,7 @@ class InstallBackendAptdaemon(InstallBackend): trans.connect("progress-details-changed", self._on_progress_download_changed) trans.connect("status-details-changed", self._on_details_changed) trans.connect("error", self._on_error_changed) - # yield trans.set_debconf_frontend("ukui") + # yield trans.set_locale(os.environ["LANGUAGE"] + ".UTF-8") yield trans.run() def _on_finished(self, trans, status, action): diff --git a/backend/kylin-system-updater b/backend/kylin-system-updater index 44645fc..c6da5ab 100755 --- a/backend/kylin-system-updater +++ b/backend/kylin-system-updater @@ -70,17 +70,17 @@ if __name__ == "__main__": else: logging.basicConfig(format=FORMAT,level=logging.DEBUG,datefmt='%m-%d,%H:%M:%S',filename = logfile(),filemode = 'a') - #目前 多用户的语言切换还未做好 不启用 - # if sys.getfilesystemencoding() == "ascii" and not "LANG" in os.environ: - # logging.info('start setting environ["LANG"] ...') - # os.environ["LANG"] = "C.UTF-8" - # os.execv(sys.argv[0], sys.argv) + #当不存在语言变量时 + if not "LANGUAGE" in os.environ: + os.environ["LANGUAGE"] = "zh_CN" + + #做一些规范处理 + if os.environ["LANGUAGE"] == "en": + os.environ["LANGUAGE"] = "en_US" + if os.environ["LANGUAGE"] == "zh_CN:en": + os.environ["LANGUAGE"] = "zh_CN" - # if not "LANGUAGE" in os.environ: - # os.environ["LANGUAGE"] = "zh_CN.UTF-8" - - # logging.info('kylin-system-updater(lang:%s) starting ...',os.environ["LANGUAGE"]) - logging.info('kylin-system-updater starting ...') + logging.info('kylin-system-updater(lang:%s) starting ...',os.environ["LANGUAGE"]) app = UpdateManager(options) From 52def11fe4560c7f7a555cf2a90c2b823aee0c63 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 24 Dec 2021 15:19:05 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/kylin-system-updater | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/kylin-system-updater b/backend/kylin-system-updater index c6da5ab..3b02249 100755 --- a/backend/kylin-system-updater +++ b/backend/kylin-system-updater @@ -60,16 +60,6 @@ if __name__ == "__main__": os.environ["TERM"] = "xterm" os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - # ensure that we are not killed when the terminal goes away e.g. on - # shutdown - signal.signal(signal.SIGHUP, signal.SIG_IGN) - signal.signal(signal.SIGINT,signal_handler_term) - - if options.debug: - logging.basicConfig(format=FORMAT,level=logging.DEBUG,datefmt='%m-%d,%H:%M:%S') - else: - logging.basicConfig(format=FORMAT,level=logging.DEBUG,datefmt='%m-%d,%H:%M:%S',filename = logfile(),filemode = 'a') - #当不存在语言变量时 if not "LANGUAGE" in os.environ: os.environ["LANGUAGE"] = "zh_CN" @@ -80,6 +70,16 @@ if __name__ == "__main__": if os.environ["LANGUAGE"] == "zh_CN:en": os.environ["LANGUAGE"] = "zh_CN" + # ensure that we are not killed when the terminal goes away e.g. on + # shutdown + signal.signal(signal.SIGHUP, signal.SIG_IGN) + signal.signal(signal.SIGINT,signal_handler_term) + + if options.debug: + logging.basicConfig(format=FORMAT,level=logging.DEBUG,datefmt='%m-%d,%H:%M:%S') + else: + logging.basicConfig(format=FORMAT,level=logging.DEBUG,datefmt='%m-%d,%H:%M:%S',filename = logfile(),filemode = 'a') + logging.info('kylin-system-updater(lang:%s) starting ...',os.environ["LANGUAGE"]) app = UpdateManager(options) From eb16f00bcce836a27eae64d97c77f62465dded17 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 24 Dec 2021 15:44:00 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManager.py | 1 + .../backend/InstallBackendAptdaemon.py | 70 ++++++++----------- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index c291bba..d088eec 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -56,6 +56,7 @@ class UpdateManager(): #数据采集器 self.collector = UpdateMsgCollector(self) + #后台aptdaemon的语言环境 self.aptdaemonLang = os.environ["LANGUAGE"] diff --git a/backend/SystemUpdater/backend/InstallBackendAptdaemon.py b/backend/SystemUpdater/backend/InstallBackendAptdaemon.py index 04f98e5..1dd37c3 100644 --- a/backend/SystemUpdater/backend/InstallBackendAptdaemon.py +++ b/backend/SystemUpdater/backend/InstallBackendAptdaemon.py @@ -1,5 +1,16 @@ #!/usr/bin/env python +import aptdaemon.client as client +import aptdaemon.errors as errors +import aptdaemon.enums as enums +from aptdaemon.enums import ( + EXIT_SUCCESS, + EXIT_FAILED, + EXIT_CANCELLED, + get_error_description_from_enum, + get_error_string_from_enum, + get_status_string_from_enum + ) from defer import inline_callbacks from SystemUpdater.backend import InstallBackend import logging @@ -24,17 +35,6 @@ class InstallBackendAptdaemon(InstallBackend): def __init__(self, window_main, action): InstallBackend.__init__(self, window_main, action) self.window_main = window_main - import aptdaemon.client as client - import aptdaemon.errors as errors - import aptdaemon.enums as enums - from aptdaemon.enums import ( - EXIT_SUCCESS, - EXIT_FAILED, - EXIT_CANCELLED, - get_error_description_from_enum, - get_error_string_from_enum, - get_status_string_from_enum - ) #切换aptdaemon的语言 重新导入模块就可以进行切换 if os.environ["LANGUAGE"] != self.window_main.aptdaemonLang: logging.warning("Aptdeamon language is switched %s to %s",self.window_main.aptdaemonLang,os.environ["LANGUAGE"]) @@ -43,14 +43,6 @@ class InstallBackendAptdaemon(InstallBackend): reload(errors) reload(enums) - self.errors = errors - self.EXIT_SUCCESS = EXIT_SUCCESS - self.EXIT_FAILED = EXIT_FAILED - self.EXIT_CANCELLED = EXIT_CANCELLED - self.get_error_description_from_enum = get_error_description_from_enum - self.get_error_string_from_enum = get_error_string_from_enum - self.get_status_string_from_enum = get_status_string_from_enum - #客户端连接aptdeamon的dbus接口 self.client = client.AptClient() self.trans_failed_msg = None @@ -127,7 +119,7 @@ class InstallBackendAptdaemon(InstallBackend): # 注册回调函数 接收更新的状态 yield self._show_transaction(trans, self.ACTION_UPDATE, _("Checking for updates…"), False) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_UPDATE, authorized=False, success=False, error_string='', error_desc='') @@ -149,11 +141,11 @@ class InstallBackendAptdaemon(InstallBackend): yield self._show_transaction(trans, self.ACTION_INSTALL, _("Installing updates…"), True) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_INSTALL, authorized=False, success=False, error_string='', error_desc='') - except self.errors.TransactionFailed as e: + except errors.TransactionFailed as e: self.trans_failed_msg = str(e) except dbus.DBusException as e: if e.get_dbus_name() != "org.freedesktop.DBus.Error.NoReply": @@ -175,7 +167,7 @@ class InstallBackendAptdaemon(InstallBackend): # 注册回调函数 接收更新的状态 yield self._show_transaction(trans, self.ACTION_INSTALL_DEB, _("Installing deb packages…"), False) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_INSTALL_DEB, authorized=False, success=False, error_string='', error_desc='') @@ -195,7 +187,7 @@ class InstallBackendAptdaemon(InstallBackend): # 注册回调函数 接收更新的状态 yield self._show_transaction(trans, self.ACTION_FIX_BROKEN, _("Installing deb packages…"), False) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_FIX_BROKEN, authorized=False, success=False, error_string='', error_desc='') @@ -214,7 +206,7 @@ class InstallBackendAptdaemon(InstallBackend): # 注册回调函数 接收更新的状态 yield self._show_transaction(trans, self.ACTION_FIX_INCOMPLETE, _("fix incomplete install"), False) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_FIX_INCOMPLETE, authorized=False, success=False, error_string='', error_desc='') @@ -233,7 +225,7 @@ class InstallBackendAptdaemon(InstallBackend): # 注册回调函数 接收更新的状态 yield self._show_transaction(trans, self.ACTION_CLEAN, _("Remove all downloaded files."), False) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_CLEAN, authorized=False, success=False, error_string='', error_desc='') @@ -252,7 +244,7 @@ class InstallBackendAptdaemon(InstallBackend): # 注册回调函数 接收更新的状态 yield self._show_transaction(trans, self.ACTION_DOWNLOADONLY, _("Downloading deb packages…"), False) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_DOWNLOADONLY, authorized=False, success=False, error_string='', error_desc='') @@ -271,7 +263,7 @@ class InstallBackendAptdaemon(InstallBackend): # 注册回调函数 接收更新的状态 yield self._show_transaction(trans, self.ACTION_REMOVE_PACKAGES, _("Installing deb packages…"), False) - except self.errors.NotAuthorizedError: + except errors.NotAuthorizedError: self._action_done(self.ACTION_REMOVE_PACKAGES, authorized=False, success=False, error_string='', error_desc='') @@ -301,7 +293,7 @@ class InstallBackendAptdaemon(InstallBackend): #同步状态回调 def _on_status_changed(self, trans, status,action): #转化词条 - self.trans_status = self.get_status_string_from_enum(status) + self.trans_status = get_status_string_from_enum(status) self._dist_status_changed(action,self.now_upgrade.upgrade_groups+self.now_upgrade.single_pkgs,\ self.trans_progress,self.trans_status,self.details) @@ -371,7 +363,7 @@ class InstallBackendAptdaemon(InstallBackend): #增加记录当产生错误的时候 详细信息 def _on_error_changed(self, trans,error_code, error_details): - # error_string = self.get_error_string_from_enum(error_code) + # error_string = get_error_string_from_enum(error_code) self.trans_error_details = str(error_details) logging.error(str(error_details)) @@ -397,29 +389,29 @@ class InstallBackendAptdaemon(InstallBackend): #退出 self.on_install_stage = False - if status == self.EXIT_FAILED: - error_string = self.get_error_string_from_enum(trans.error.code) - error_desc = self.get_error_description_from_enum(trans.error.code) + if status == EXIT_FAILED: + error_string = get_error_string_from_enum(trans.error.code) + error_desc = get_error_description_from_enum(trans.error.code) if self.trans_failed_msg: error_desc = error_desc + "\n" + self.trans_failed_msg #取消下载 - elif status == self.EXIT_CANCELLED: + elif status == EXIT_CANCELLED: error_string = _("Failed to fetch") error_desc = _("_Cancel Upgrade") - elif status == self.EXIT_SUCCESS and action == self.ACTION_INSTALL: + elif status == EXIT_SUCCESS and action == self.ACTION_INSTALL: error_string = _("System upgrade is complete.") - elif status == self.EXIT_SUCCESS and action == self.ACTION_REMOVE_PACKAGES: + elif status == EXIT_SUCCESS and action == self.ACTION_REMOVE_PACKAGES: error_string = _("Uninstallation completed") - is_success = (status == self.EXIT_SUCCESS) + is_success = (status == EXIT_SUCCESS) try: self._action_done(action, - is_cancelled=(status == self.EXIT_CANCELLED), success=is_success, + is_cancelled=(status == EXIT_CANCELLED), success=is_success, error_string=error_string, error_desc=error_desc) except TypeError: # this module used to be be lazily imported and in older code # trans_failed= is not accepted # TODO: this workaround can be dropped in Ubuntu 20.10 self._action_done(action, - is_cancelled=(status == self.EXIT_CANCELLED), success=is_success, + is_cancelled=(status == EXIT_CANCELLED), success=is_success, error_string=error_string, error_desc=error_desc) From dab8a68e3158d49f98631ef26189f5e839bcda1a Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 24 Dec 2021 15:45:03 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/InstallBackendDpkg.py | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100755 backend/SystemUpdater/backend/InstallBackendDpkg.py diff --git a/backend/SystemUpdater/backend/InstallBackendDpkg.py b/backend/SystemUpdater/backend/InstallBackendDpkg.py deleted file mode 100755 index 8637d50..0000000 --- a/backend/SystemUpdater/backend/InstallBackendDpkg.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*- -# (c) 2005-2007 Canonical, GPL - -import os -import tempfile -from gettext import gettext as _ -import apt -import logging -import fcntl -import apt_pkg -from SystemUpdater.backend import InstallBackend - -class InstallBackendDpkg(InstallBackend): - pass - - -# class InstallBackendSynaptic(InstallBackend): -# """ Install backend based on synaptic """ - -# def update(self): -# opt = ["--update-at-startup"] -# tempf = None -# self._run_synaptic(self.ACTION_UPDATE, opt, tempf) - -# def commit(self, pkgs_install, pkgs_upgrade, pkgs_remove, -# close_on_done=False): -# # close when update was successful (its ok to use a Synaptic:: -# # option here, it will not get auto-saved, because synaptic does -# # not save options in non-interactive mode) -# opt = [] -# if close_on_done: -# opt.append("-o") -# opt.append("Synaptic::closeZvt=true") -# # custom progress strings -# opt.append("--progress-str") -# opt.append("%s" % _("Please wait, this can take some time.")) -# opt.append("--finish-str") -# opt.append("%s" % _("Update is complete")) -# tempf = tempfile.NamedTemporaryFile(mode="w+") -# for pkg_name in pkgs_install + pkgs_upgrade: -# tempf.write("%s\tinstall\n" % pkg_name) -# for pkg_name in pkgs_remove: -# tempf.write("%s\tdeinstall\n" % pkg_name) -# opt.append("--set-selections-file") -# opt.append("%s" % tempf.name) -# tempf.flush() -# self._run_synaptic(self.ACTION_INSTALL, opt, tempf) - -# def _run_synaptic(self, action, opt, tempf): -# """Execute synaptic.""" -# win = self.window_main.get_window() -# try: -# xid = win.get_xid() -# except AttributeError: -# xid = 0 -# cmd = ["/usr/bin/pkexec", "/usr/sbin/synaptic", "--hide-main-window", -# "--non-interactive", "--parent-window-id", -# "%s" % xid] -# cmd.extend(opt) -# flags = GObject.SPAWN_DO_NOT_REAP_CHILD -# (pid, stdin, stdout, stderr) = GObject.spawn_async(cmd, flags=flags) -# # Keep a reference to the data tuple passed to -# # GObject.child_watch_add to avoid attempts to destroy it without a -# # thread context: https://bugs.launchpad.net/bugs/724687 -# self.child_data = (action, tempf) -# GObject.child_watch_add(pid, self._on_synaptic_exit, self.child_data) - -# def _on_synaptic_exit(self, pid, condition, data): -# action, tempf = data -# if tempf: -# tempf.close() -# self._action_done(action, -# authorized=True, -# success=os.WEXITSTATUS(condition) == 0, -# error_string=None, error_desc=None) From b13b4ebe53af6989a82cfff79ad1d73987c51ec4 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 24 Dec 2021 17:45:54 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E8=BF=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/DataAcquisition.py | 1 - backend/SystemUpdater/UpdateManagerDbus.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/SystemUpdater/Core/DataAcquisition.py b/backend/SystemUpdater/Core/DataAcquisition.py index 9c9d926..e59fd4c 100644 --- a/backend/SystemUpdater/Core/DataAcquisition.py +++ b/backend/SystemUpdater/Core/DataAcquisition.py @@ -63,7 +63,6 @@ class UpdateMsgCollector(): # 获取本地tid self.sender.GetLocalTid() PackageInfo["tid"] = str(self.sender.localtid) - logging.info("Get local tid:(%s).",self.sender.localtid) json_PackageInfo = self.convertor.dictConvertJson(PackageInfo) diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index 6a11d13..59285c6 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -149,12 +149,12 @@ class UpdateManagerDbusController(dbus.service.Object): @dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='s',out_signature='i') def GetBackendStatus(self,user_lang): try: + #处于更新和升级中的话 不进行更新 + logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' GetBackendStatus ...') if user_lang != os.environ["LANGUAGE"]: logging.warning("The system language is switched %s to %s",os.environ["LANGUAGE"],user_lang) os.environ["LANGUAGE"] = user_lang - #处于更新和升级中的话 不进行更新 - logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' GetBackendStatus ...') return self.parent.is_working except Exception: return False From ac3be40c9a99b73e1febf41a91a83e8c14ccb3e9 Mon Sep 17 00:00:00 2001 From: wangsong Date: Mon, 27 Dec 2021 11:15:24 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=A4=A7=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=87=87=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/Database.py | 20 ++++++++++---------- backend/SystemUpdater/UpdateManager.py | 6 ++---- backend/SystemUpdater/UpdateManagerDbus.py | 8 +++----- backend/kylin-system-updater | 2 +- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/backend/SystemUpdater/Core/Database.py b/backend/SystemUpdater/Core/Database.py index 1fa655e..18744d9 100644 --- a/backend/SystemUpdater/Core/Database.py +++ b/backend/SystemUpdater/Core/Database.py @@ -164,7 +164,7 @@ class Sqlite3Server(object): UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(UpdateInfos.copy()) UpdateInfos.clear() - self.window_main.collector.UpdateMsg("UpdateInfos", json_file) + # self.window_main.collector.UpdateMsg("UpdateInfos", json_file) #安装信息install-infos InstallInfos.update({"packageName":str(pkgname)}) if pkgname in self.window_main.update_list.local_upgrade_data.versoin_pkgs['groups_upgrade'].keys(): @@ -175,7 +175,7 @@ class Sqlite3Server(object): InstallInfos.update({"status":status}) InstallInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(InstallInfos.copy()) - self.window_main.collector.UpdateMsg("InstallInfos", json_file) + # self.window_main.collector.UpdateMsg("InstallInfos", json_file) elif pkg_list: # 单包更新 # 获取单包数据插入数据库 pkgname = pkg_list.pop(0) @@ -213,7 +213,7 @@ class Sqlite3Server(object): UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(UpdateInfos.copy()) UpdateInfos.clear() - self.window_main.collector.UpdateMsg("UpdateInfos", json_file) + # self.window_main.collector.UpdateMsg("UpdateInfos", json_file) #安装信息install-infos InstallInfos.update({"packageName":str(pkgname)}) if pkgname in self.window_main.update_list.local_upgrade_data.versoin_pkgs['single_upgrade'].keys(): @@ -224,7 +224,7 @@ class Sqlite3Server(object): InstallInfos.update({"status":status}) InstallInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(InstallInfos.copy()) - self.window_main.collector.UpdateMsg("InstallInfos", json_file) + # self.window_main.collector.UpdateMsg("InstallInfos", json_file) try: self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr) @@ -257,7 +257,7 @@ class Sqlite3Server(object): UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(UpdateInfos.copy()) UpdateInfos.clear() - self.window_main.collector.UpdateMsg("UpdateInfos", json_file) + # self.window_main.collector.UpdateMsg("UpdateInfos", json_file) #安装信息install-infos InstallInfos.update({"packageName":str(pkg.name)}) if pkg.name in self.window_main.update_list.local_upgrade_data.versoin_pkgs['groups_upgrade'].keys(): @@ -268,7 +268,7 @@ class Sqlite3Server(object): InstallInfos.update({"status":status}) InstallInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(InstallInfos.copy()) - self.window_main.collector.UpdateMsg("InstallInfos", json_file) + # self.window_main.collector.UpdateMsg("InstallInfos", json_file) try: self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr) @@ -289,7 +289,7 @@ class Sqlite3Server(object): UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(UpdateInfos.copy()) UpdateInfos.clear() - self.window_main.collector.UpdateMsg("UpdateInfos", json_file) + # self.window_main.collector.UpdateMsg("UpdateInfos", json_file) #安装信息install-infos InstallInfos.update({"packageName":str(i)}) if i in self.window_main.update_list.local_upgrade_data.versoin_pkgs['groups_upgrade'].keys(): @@ -300,7 +300,7 @@ class Sqlite3Server(object): InstallInfos.update({"status":status}) InstallInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(InstallInfos.copy()) - self.window_main.collector.UpdateMsg("InstallInfos", json_file) + # self.window_main.collector.UpdateMsg("InstallInfos", json_file) try: self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr) group_list = [] @@ -328,7 +328,7 @@ class Sqlite3Server(object): UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(UpdateInfos.copy()) UpdateInfos.clear() - self.window_main.collector.UpdateMsg("UpdateInfos", json_file) + # self.window_main.collector.UpdateMsg("UpdateInfos", json_file) #安装信息install-infos InstallInfos.update({"packageName":str(pkg.name)}) if pkg.name in self.window_main.update_list.local_upgrade_data.versoin_pkgs['groups_upgrade'].keys(): @@ -339,7 +339,7 @@ class Sqlite3Server(object): InstallInfos.update({"status":status}) InstallInfos.update({"errorCode":str(error_string+" "+error_desc)}) json_file = json.dumps(InstallInfos.copy()) - self.window_main.collector.UpdateMsg("InstallInfos", json_file) + # self.window_main.collector.UpdateMsg("InstallInfos", json_file) try: self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr) # 数据库文件被删除或者新增字段导致需要重新初始化数据库再写入 diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index d088eec..574c403 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -3,7 +3,9 @@ import os import subprocess from apt import Cache +import apt_pkg import sys +import time import shutil import dbus import logging @@ -20,10 +22,8 @@ from .Core.Database import Sqlite3Server from .Core.loop import mainloop from .Core.DataAcquisition import UpdateMsgCollector -import time from gettext import gettext as _ from SystemUpdater.backend import DownloadBackend as downb -import apt_pkg from SystemUpdater.Core.UpdaterConfigParser import UpgradeConfig from SystemUpdater.Core.utils import get_broken_details,get_lis_from_cache from SystemUpdater.Core.DpkgInstallProgress import LogInstallProgress @@ -434,9 +434,7 @@ class UpdateManager(): def _setup_dbus(self): # check if there is another g-a-i already and if not setup one # listening on dbus - bus = dbus.SystemBus() - try: bus_name = dbus.service.BusName(UPDATER_DBUS_SERVICE, bus, diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index 59285c6..26128e8 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -42,8 +42,6 @@ COLORMETHOR_PREFIX = FRONT_COLOR_SEQ % CYAN class UpdateManagerDbusController(dbus.service.Object): """ this is a helper to provide the UpdateManagerIFace """ - UPDATER_DBUS_INTERFACE = 'com.kylin.systemupgrade.interface' - def __init__(self, parent, bus_name, object_path=UPDATER_DBUS_PATH): dbus.service.Object.__init__(self, bus_name, object_path) @@ -333,12 +331,12 @@ class UpdateManagerDbusController(dbus.service.Object): @dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='ss', sender_keyword='sender') def InsertInstallState(self, item, value, sender=None): try: - logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' InsertInstallState, options:%s,value:%s' % (item, value)) + logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' InsertInstallState, options:%s,value:%s' % (item, value)) self.parent.sqlite3_server.insert_into_display(item, value) - logging.info("Database inserted successfully,options:%s,value:%s" % (item, value)) + logging.info("Database inserted successfully,options:%s,value:%s" % (item, value)) return True except Exception as e: - logging.error("Database insert failed,options:%s,value:%s" % (item, value)) + logging.error("Database insert failed,options:%s,value:%s" % (item, value)) return False # # download certain package and its dependencies diff --git a/backend/kylin-system-updater b/backend/kylin-system-updater index 3b02249..76114a7 100755 --- a/backend/kylin-system-updater +++ b/backend/kylin-system-updater @@ -60,7 +60,7 @@ if __name__ == "__main__": os.environ["TERM"] = "xterm" os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - #当不存在语言变量时 + #当不存在语言变量时 默认显示中文 if not "LANGUAGE" in os.environ: os.environ["LANGUAGE"] = "zh_CN" From 47bff74d5d920aa887c5b6449eec1e9c9bdc98c6 Mon Sep 17 00:00:00 2001 From: wangsong Date: Tue, 28 Dec 2021 16:53:25 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E5=89=B2?= =?UTF-8?q?=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManagerDbus.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index 26128e8..f42ebf0 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -9,9 +9,8 @@ from gettext import gettext as _ from .backend import InstallBackend from .Core.loop import mainloop from .Core.utils import humanize_size -from SystemUpdater.Core.utils import ( - unLockedEnableShutdown, -) +from SystemUpdater.Core.utils import unLockedEnableShutdown +import locale UPDATER_DBUS_INTERFACE = 'com.kylin.systemupgrade.interface' UPDATER_DBUS_PATH = '/com/kylin/systemupgrade' @@ -147,11 +146,12 @@ class UpdateManagerDbusController(dbus.service.Object): @dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='s',out_signature='i') def GetBackendStatus(self,user_lang): try: + (lang, encoding) = locale._parse_localename(str(user_lang)) #处于更新和升级中的话 不进行更新 logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' GetBackendStatus ...') - if user_lang != os.environ["LANGUAGE"]: - logging.warning("The system language is switched %s to %s",os.environ["LANGUAGE"],user_lang) - os.environ["LANGUAGE"] = user_lang + if lang != os.environ["LANGUAGE"]: + logging.warning("The system language is switched %s to %s",os.environ["LANGUAGE"],lang) + os.environ["LANGUAGE"] = lang return self.parent.is_working except Exception: From ccf8115607dfa6ea3b0255bd29d167e14bd022b3 Mon Sep 17 00:00:00 2001 From: wangsong Date: Thu, 30 Dec 2021 16:29:37 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BD=93=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=85=89=E7=9B=98=E6=BA=90=E6=97=B6=E4=B8=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=BD=91=E7=BB=9C=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManager.py | 37 +++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index 574c403..e312f7b 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -32,6 +32,8 @@ class UpdateManager(): SELF_PKG_NAME = 'kylin-system-updater' GROUPS_PKG_NAME = 'kylin-update-desktop-config' INSTALL_ALONE_PROGRESS = "alone" + SOURCE_PARTS_PATH = "/etc/apt/" + SOURCE_FILE_NAME = "sources.list" def __init__(self,options): self.options = options @@ -118,6 +120,27 @@ class UpdateManager(): except Exception as e: logging.error(str(e)) + #读取source.list 内容 + def _read_source_list(self): + try: + source_file_content = '' + source_file_path = os.path.join(self.SOURCE_PARTS_PATH,self.SOURCE_FILE_NAME) + with open(source_file_path) as source_file: + source_file_content = source_file.read() + return source_file_content + except Exception as e: + logging.error(str(e)) + return '' + + #判断是否为光盘源 + def _is_disc_source(self): + source_file_content = self._read_source_list() + if "deb file:" in source_file_content: + logging.info("Current use of CD-ROM source without network check...") + return True + else: + return False + #进行更新的操作 def start_update(self): _success = True @@ -128,12 +151,14 @@ class UpdateManager(): #每次更新之前 重新读取配置文件 刷新参数 self.configs.reReadConfigFiles() - #进行检查网络 - self.dbusController.UpdateDetectStatusChanged(5,_("Checking network connection")) - _success,header,desc = self.dbusController.check_connectivity() - if _success == False: - self.dbusController.DistUpdateDetectFinished(_success,[],header,desc) - return + #光盘源的话 不进行网络检查 + if self._is_disc_source() != True: + #进行检查网络 + self.dbusController.UpdateDetectStatusChanged(5,_("Checking network connection")) + _success,header,desc = self.dbusController.check_connectivity() + if _success == False: + self.dbusController.DistUpdateDetectFinished(_success,[],header,desc) + return #从服务器端更新摸板 if self.options.no_update_source is False: From 94cd21e406795c839a404f4e095b5760c01f2b52 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 31 Dec 2021 15:33:25 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=85=B3=E7=9B=98=E6=BA=90=E6=97=B6=20?= =?UTF-8?q?=E7=A6=81=E6=AD=A2=E7=BD=91=E7=BB=9C=E6=A3=80=E6=9F=A5=20?= =?UTF-8?q?=E6=9B=B4=E6=BA=90=E6=A8=A1=E6=9D=BF=20=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=BA=90=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index e312f7b..85a62bd 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -159,6 +159,11 @@ class UpdateManager(): if _success == False: self.dbusController.DistUpdateDetectFinished(_success,[],header,desc) return + else: + #当判断为光盘源时 关闭源过滤 + self.options.close_filter = True + #关闭 更新源模板 + self.options.no_update_source = True #从服务器端更新摸板 if self.options.no_update_source is False: From fa19fdc0d88e149081736123d6d0f6ad55502f8c Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 31 Dec 2021 16:15:31 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManager.py | 16 ++++++++++------ backend/kylin-system-updater | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index 85a62bd..efa4dc7 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -152,18 +152,22 @@ class UpdateManager(): self.configs.reReadConfigFiles() #光盘源的话 不进行网络检查 - if self._is_disc_source() != True: + if self._is_disc_source() == True: + logging.info("Turn off NetworkCheck and CloseFiter and UpdateSource...") + #关闭网络检查 + self.options.no_check_network = True + #当判断为光盘源时 关闭源过滤 + self.options.close_filter = True + #关闭 更新源模板 + self.options.no_update_source = True + + if self.options.no_check_network is False: #进行检查网络 self.dbusController.UpdateDetectStatusChanged(5,_("Checking network connection")) _success,header,desc = self.dbusController.check_connectivity() if _success == False: self.dbusController.DistUpdateDetectFinished(_success,[],header,desc) return - else: - #当判断为光盘源时 关闭源过滤 - self.options.close_filter = True - #关闭 更新源模板 - self.options.no_update_source = True #从服务器端更新摸板 if self.options.no_update_source is False: diff --git a/backend/kylin-system-updater b/backend/kylin-system-updater index 76114a7..ac105f1 100755 --- a/backend/kylin-system-updater +++ b/backend/kylin-system-updater @@ -47,6 +47,10 @@ if __name__ == "__main__": default=False, action="store_true", dest="close_filter", help=_("Quit and close allowed_origin")) + parser.add_option("--no-check-network", + default=False, + action="store_true", dest="no_check_network", + help=_("Quit and close check_network")) (options, args) = parser.parse_args() From 57049c1550ea2a833a5ae45f144e3e3df36e9e61 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 31 Dec 2021 16:42:18 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E7=9A=84=E7=A8=B3=E5=AE=9A=E6=80=A7=EF=BC=8C?= =?UTF-8?q?=E5=BD=93=E4=B9=8B=E5=89=8D=E6=9C=AA=E9=80=80=E5=87=BA=E6=97=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E9=80=80=E5=87=BA=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9C=AA=E9=80=80=E5=87=BA=E6=88=90=E5=8A=9F=E6=97=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=87=8D=E8=AF=95=EF=BC=8C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E9=99=90=E5=AE=9A=E9=87=8D=E5=90=AF=E6=AC=A1=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E9=98=88=E5=80=BC=E4=B8=BA5=E6=AC=A1=E8=B6=85=E5=87=BA?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E7=A8=8B=E5=BA=8F=E9=87=8D=E5=90=AF=E9=80=80?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManager.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index efa4dc7..f65a7c2 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -480,15 +480,32 @@ class UpdateManager(): logging.critical("Another daemon is already running") sys.exit(1) logging.warning("Replacing already running daemon") + + retry_reboot_times = 0 the_other_guy = bus.get_object(UPDATER_DBUS_SERVICE, UPDATER_DBUS_PATH) the_other_guy.Quit(dbus_interface=UPDATER_DBUS_INTERFACE, timeout=300) time.sleep(1) - bus_name = dbus.service.BusName(UPDATER_DBUS_SERVICE, - bus, - do_not_queue=True) - return UpdateManagerDbusController(self, bus_name) + while True: + retry_reboot_times = retry_reboot_times + 1 + #当重试次数超过5次时退出程序 + if retry_reboot_times > 5: + logging.critical("Reboot backend is Failed...") + sys.exit(1) + try: + bus_name = dbus.service.BusName(UPDATER_DBUS_SERVICE, + bus, + do_not_queue=True) + logging.warning("Replacing already running daemon to Success...") + return UpdateManagerDbusController(self, bus_name) + except dbus.exceptions.NameExistsException: + the_other_guy = bus.get_object(UPDATER_DBUS_SERVICE, + UPDATER_DBUS_PATH) + the_other_guy.Quit(dbus_interface=UPDATER_DBUS_INTERFACE, + timeout=300) + logging.error("Dbus has not withdrawn and retry reboot times:%d...",retry_reboot_times) + time.sleep(1) # 是否查找本地依赖 def _attempt_depends(self,deb_cache, deb_path,_check_local_dep,_auto_satisfy, _install): From cd00c1ada57baa9801d5fd600fc6d2f95c1a79f0 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 31 Dec 2021 17:06:26 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/kylin-system-updater | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/kylin-system-updater b/backend/kylin-system-updater index ac105f1..2d35bcb 100755 --- a/backend/kylin-system-updater +++ b/backend/kylin-system-updater @@ -42,21 +42,20 @@ if __name__ == "__main__": help=_("Do not check for updates source when updating")) parser.add_option ("--no-update", action="store_true", dest="no_update", default=False, - help=_("Do not check for updates when starting")) + help="Do not check for updates when starting") parser.add_option("-c", "--close-filter", default=False, action="store_true", dest="close_filter", - help=_("Quit and close allowed_origin")) + help=_("Quit and close allowed origin")) parser.add_option("--no-check-network", default=False, action="store_true", dest="no_check_network", - help=_("Quit and close check_network")) + help=_("Quit and close check network")) (options, args) = parser.parse_args() if os.getuid() != 0: print(_("You need to be root to run this application")) - sys.exit(1) # set debconf to NON_INTERACTIVE From d097bdf3efd5cceabbbc18e110b2c1f1786619a4 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 31 Dec 2021 18:04:08 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=84=E7=A7=8D=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/UpdateList.py | 10 +++++----- backend/SystemUpdater/UpdateManager.py | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/SystemUpdater/Core/UpdateList.py b/backend/SystemUpdater/Core/UpdateList.py index 8ff798f..1d18679 100644 --- a/backend/SystemUpdater/Core/UpdateList.py +++ b/backend/SystemUpdater/Core/UpdateList.py @@ -103,11 +103,11 @@ class UpdateList(): if not os.path.exists(OUTPUT_CONFIG_PATH): os.makedirs(OUTPUT_CONFIG_PATH) - logging.info('making the configuration file is complete...') + logging.info('making the ConfigPath(%s) is complete...',OUTPUT_CONFIG_PATH) else: shutil.rmtree(OUTPUT_CONFIG_PATH) os.makedirs(OUTPUT_CONFIG_PATH) - logging.info('Emptying the configuration file is complete...') + logging.info('Emptying the ConfigPath(%s) is complete...',OUTPUT_CONFIG_PATH) except Exception as e: logging.error(str(e)) @@ -276,7 +276,7 @@ class UpdateList(): return [],[] #输出白名单的配置 - def _make_white_config(self,cache,upgrade_data): + def _make_autoupgrade_config(self,cache,upgrade_data): try: pkgs_install,pkgs_upgrade = self._make_pkgs_list(cache,upgrade_data.upgrade_groups_pkgs,upgrade_data.upgrade_groups,upgrade_data.single_pkgs) @@ -288,7 +288,7 @@ class UpdateList(): pkgs_upgrade_str=pkgs_upgrade_str[:-1] self.parent.configs.setValue("AutoUpgrade","upgradelist",pkgs_upgrade_str,True) - logging.info("Generate Configfile to complete...") + logging.info("Generate AutoUpgrade Configfile to Complete and Upgradable Number:%d...",len(pkgs_upgrade + pkgs_install)) except Exception as e: logging.error(e) @@ -508,7 +508,7 @@ class UpdateList(): #分组的包的JSON self._make_groups_upgrade(cache,group_important_list,[pkg.name for pkg in pkgs_upgrade]) - self._make_white_config(cache,self.local_upgrade_data) + self._make_autoupgrade_config(cache,self.local_upgrade_data) #是否存在可升级的组 if self.local_upgrade_data.upgrade_groups or self.local_upgrade_data.single_pkgs: return True,header,desc diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index f65a7c2..e6b054c 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -134,6 +134,7 @@ class UpdateManager(): #判断是否为光盘源 def _is_disc_source(self): + logging.info("Check: Whether to use CD-ROM source updates Successfully...") source_file_content = self._read_source_list() if "deb file:" in source_file_content: logging.info("Current use of CD-ROM source without network check...") @@ -151,7 +152,7 @@ class UpdateManager(): #每次更新之前 重新读取配置文件 刷新参数 self.configs.reReadConfigFiles() - #光盘源的话 不进行网络检查 + #光盘源的话 if self._is_disc_source() == True: logging.info("Turn off NetworkCheck and CloseFiter and UpdateSource...") #关闭网络检查