diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index 4c23832..d929c74 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -1,6 +1,6 @@ # UpdateManager.py # -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*- -import os +import os,apt import apt_pkg import sys import time @@ -747,6 +747,7 @@ class UpdateManager(): self._is_broken = False except KeyError: pass + # except apt except Exception as e: logging.error(str(e)) self._need_downgrade = False diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index d10ce42..e4aa282 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -370,13 +370,22 @@ class UpdateManagerDbusController(dbus.service.Object): if str(user_lang) == '': logging.info("The incoming language is null...") else: - (lang, encoding) = locale._parse_localename(str(user_lang)) + (input_lang, encoding) = locale._parse_localename(str(user_lang)) + (local_lang, encoding) = locale._parse_localename(str(os.environ["LANG"])) + (local_language, encoding) = locale._parse_localename(str(os.environ["LANGUAGE"])) + #合法性的校验 - if lang == None or lang == '': + if input_lang == None or input_lang == '': logging.info("The incoming language is Illegal...") - 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.now_working + + #处于更新和升级中的话 不进行更新 + if input_lang != local_language or input_lang != local_lang: + logging.warning("LANG: switched %s to %s",os.environ["LANG"],user_lang) + logging.warning("LANGUAGE: switched %s to %s",os.environ["LANGUAGE"],user_lang) + os.environ["LANG"] = user_lang + os.environ["LANGUAGE"] = user_lang + self.parent.aptd_lang_switch = True reload(enums) sender_name = get_proc_from_dbus_name(sender) logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' DistPurgePackages Sender:%s and purge list is:%s...',sender_name,_purge_list) @@ -441,13 +450,22 @@ class UpdateManagerDbusController(dbus.service.Object): if str(user_lang) == '': logging.info("The incoming language is null...") else: - (lang, encoding) = locale._parse_localename(str(user_lang)) + (input_lang, encoding) = locale._parse_localename(str(user_lang)) + (local_lang, encoding) = locale._parse_localename(str(os.environ["LANG"])) + (local_language, encoding) = locale._parse_localename(str(os.environ["LANGUAGE"])) + #合法性的校验 - if lang == None or lang == '': + if input_lang == None or input_lang == '': logging.info("The incoming language is Illegal...") - 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.now_working + + #处于更新和升级中的话 不进行更新 + if input_lang != local_language or input_lang != local_lang: + logging.warning("LANG: switched %s to %s",os.environ["LANG"],user_lang) + logging.warning("LANGUAGE: switched %s to %s",os.environ["LANGUAGE"],user_lang) + os.environ["LANG"] = user_lang + os.environ["LANGUAGE"] = user_lang + self.parent.aptd_lang_switch = True reload(enums) sender_name = get_proc_from_dbus_name(sender) self._check_prohibit_user(sender_name) @@ -750,7 +768,7 @@ class UpdateManagerDbusController(dbus.service.Object): if not os.path.exists("/etc/kylin-version/kylin-system-version.conf"): logging.warning("System version file doesn't exist.") update_version,os_version = self.parent.sqlite3_server.get_default_version() - return os_version,update_version + return str(os_version),str(update_version) os_version = str(self.parent.sqlite3_server.ucconfigs.get("SYSTEM","os_version")) update_version = str(self.parent.sqlite3_server.ucconfigs.get("SYSTEM","update_version")) except Exception as e: