Merge branch 'backend_manual' into 'backend_uu'
Backend manual See merge request kylin-desktop/update-manager-group/kylin-system-updater!471
This commit is contained in:
commit
343898eb37
|
@ -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
|
||||
|
|
|
@ -13,6 +13,7 @@ from .Core.errors import *
|
|||
# from .Core.enums import *
|
||||
from .Core.utils import humanize_size
|
||||
from SystemUpdater.Core.utils import get_proc_from_dbus_name,PolicyKit_Authority
|
||||
from SystemUpdater.Core.UpdaterConfigParser import UpgradeConfig
|
||||
import locale
|
||||
from xml.etree import ElementTree
|
||||
from .Core.MyCache import MyCache
|
||||
|
@ -370,13 +371,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 +451,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)
|
||||
|
@ -747,10 +766,11 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
os_version = ''
|
||||
update_version = ''
|
||||
try:
|
||||
self.parent.sqlite3_server.ucconfigs = UpgradeConfig(datadir = "/etc/kylin-version", name = "kylin-system-version.conf")
|
||||
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:
|
||||
|
|
|
@ -733,8 +733,8 @@ class InstallBackend():
|
|||
|
||||
elif action == self.ACTION_UPDATE and self.action_mode == self.MODE_UPDATE_ALL:
|
||||
if success == False:
|
||||
threading_emulate = threading.Thread(target=self.emulate_update)
|
||||
threading_emulate.start()
|
||||
# threading_emulate = threading.Thread(target=self.emulate_update)
|
||||
# threading_emulate.start()
|
||||
|
||||
if ERROR_UPDATE_KEY_SIGNATURES in self.aptd_base.error_details:
|
||||
error_desc = get_error_description_from_enum(ERROR_UPDATE_KEY_SIGNATURES)
|
||||
|
|
Loading…
Reference in New Issue