Merge branch 'backend_manual' into 'backend_uu'
Backend manual See merge request kylin-desktop/update-manager-group/kylin-system-updater!454
This commit is contained in:
commit
e081adbea6
|
@ -359,7 +359,7 @@ class UpdateList():
|
|||
with open(self.parent.config_path+ifile,'r') as f:
|
||||
try:
|
||||
data = json.load(f)
|
||||
except json.JSONDecodeError as exc:
|
||||
except Exception as exc:
|
||||
logging.error(exc)
|
||||
continue
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ __all__ = (
|
|||
"ERROR_NOT_FIX_SYSTEM",
|
||||
"ERROR_UPDATE_KEY_SIGNATURES","ERROR_UPDATE_NET_AUTHENTICATION","ERROR_UPDATE_NOTREAD_SOURCES","PRIORITY_UPGRADE_SUCCCESSED",
|
||||
|
||||
"get_error_description_from_enum", "get_error_string_from_enum", "get_source_name_from_enum")
|
||||
"get_error_description_from_enum", "get_error_string_from_enum", "get_source_name_from_enum", "get_caller_from_enum")
|
||||
|
||||
import gettext
|
||||
gettext.bindtextdomain('kylin-system-updater', '/usr/share/locale')
|
||||
|
@ -110,6 +110,13 @@ SOURCE_NAME = {
|
|||
'kylin-software-center':_("Kylin Software Center"),
|
||||
}
|
||||
|
||||
CALLER = {
|
||||
'kylin-installer':"Kylin Installer",
|
||||
'kylin-uninstaller':"Kylin Uninstaller",
|
||||
'kylin-background-upgrade':"Kylin Background Upgrade",
|
||||
'kylin-software-center':"Kylin Software Center",
|
||||
}
|
||||
|
||||
def get_error_description_from_enum(enum):
|
||||
"""Get a long description of an error.
|
||||
|
||||
|
@ -140,4 +147,10 @@ def get_source_name_from_enum(enum):
|
|||
except KeyError:
|
||||
return _("Kylin System Updater")
|
||||
|
||||
def get_caller_from_enum(enum):
|
||||
try:
|
||||
return CALLER[enum]
|
||||
except KeyError:
|
||||
return _("Kylin System Updater")
|
||||
|
||||
# vim:ts=4:sw=4:et
|
||||
|
|
|
@ -47,7 +47,7 @@ class UpdateManager():
|
|||
self.update_list = None
|
||||
#表示后端的状态 注意:这个状态很重要 用不好整个后端代码就会卡住
|
||||
self.now_working = InstallBackend.ACTION_DEFUALT_STATUS
|
||||
self.config_path = self.check_config_patch()
|
||||
self.config_path = self.refresh_config_patch()
|
||||
#建立dbus
|
||||
self.dbusController = self._setup_dbus()
|
||||
self.dbusControllerUtils = self._setup_dbus_utils()
|
||||
|
@ -109,7 +109,7 @@ class UpdateManager():
|
|||
|
||||
apt_pkg.init_system()
|
||||
|
||||
def check_config_patch(self):
|
||||
def refresh_config_patch(self):
|
||||
NOW_UPDATE_CONFIG = '/usr/share/kylin-update-desktop-config/config/'
|
||||
OLD_UPDATE_CONFIG = '/usr/share/kylin-update-desktop-config/data/'
|
||||
if os.path.exists(NOW_UPDATE_CONFIG):
|
||||
|
@ -208,7 +208,6 @@ class UpdateManager():
|
|||
try:
|
||||
#更新前的准备
|
||||
self.configs_cover.reReadConfigFiles()
|
||||
self.check_config_patch()
|
||||
self.retry_limit = self.RETRY_LIMIT_NUM
|
||||
|
||||
self.install_mode.reset_shutdown_mode()
|
||||
|
@ -247,6 +246,7 @@ class UpdateManager():
|
|||
|
||||
def start_available(self):
|
||||
try:
|
||||
self.refresh_config_patch()
|
||||
self.refresh_cache()
|
||||
|
||||
#提高生成对象的位置
|
||||
|
@ -553,6 +553,7 @@ class UpdateManager():
|
|||
return
|
||||
# 验签提权
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
caller = get_caller_from_enum(sender_name)
|
||||
if deb_verify(deb_path) != 0: #验签失败,提权
|
||||
(status,error_string) = PolicyKit_Authority(get_source_name_from_enum(sender_name)+_(" requires authentication to install software packages."),sender)
|
||||
if not status:
|
||||
|
@ -572,7 +573,7 @@ class UpdateManager():
|
|||
if dep_satisfy:
|
||||
try:
|
||||
install_backend = get_backend(self, InstallBackend.ACTION_INSTALL_DEB)
|
||||
install_backend.start_alone(partial_upgrade_list = deb_path, _is_install = _auto_satisfy)
|
||||
install_backend.start_alone(partial_upgrade_list = deb_path, _is_install = _auto_satisfy, caller=caller)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
else:
|
||||
|
@ -853,6 +854,8 @@ class UpdateManager():
|
|||
class UpdateEssentialItem():
|
||||
def __init__(self,parent):
|
||||
self.essential_pkgs = []
|
||||
self.remove_white = []
|
||||
|
||||
self.read_path = parent.config_path + 'kylin-update-desktop-system.json'
|
||||
self.update()
|
||||
logging.info("Initialize Essential Packages List...")
|
||||
|
@ -860,17 +863,30 @@ class UpdateEssentialItem():
|
|||
def update(self):
|
||||
if os.path.exists(self.read_path):
|
||||
with open(self.read_path,'r') as f:
|
||||
data = json.load(f)
|
||||
try:
|
||||
data = json.load(f)
|
||||
self.essential_pkgs = data['install_list']
|
||||
except json.JSONDecodeError as exc:
|
||||
logging.error(exc)
|
||||
except Exception as exc:
|
||||
pass
|
||||
# logging.warning(exc)
|
||||
try:
|
||||
self.remove_white = data['remove_white_list']
|
||||
except Exception as exc:
|
||||
pass
|
||||
# logging.warning(exc)
|
||||
|
||||
def check(self,remove_pkgs):
|
||||
def check_essential(self,remove_pkgs):
|
||||
logging.info("Check: For remove of Essential Packages...")
|
||||
for pkg in remove_pkgs:
|
||||
if pkg in self.essential_pkgs:
|
||||
raise UpdateBaseError(ERROR_REMOVE_ESSENTIAL_PACKAGES)
|
||||
|
||||
def check_white(self,remove_pkgs):
|
||||
logging.info("Check: remove pkg in White Packages...")
|
||||
for pkg in remove_pkgs:
|
||||
if pkg in self.remove_white:
|
||||
logging.info("%s will be remove in remove pkg...",pkg)
|
||||
remove_pkgs.remove(pkg)
|
||||
|
||||
class UpdateSourceInfo():
|
||||
DIR_MRDIA = "/media/"
|
||||
|
@ -941,7 +957,7 @@ class InhibitShutdownLock():
|
|||
self.inhibit_lock = None
|
||||
|
||||
#安装时禁止关机 进行加锁
|
||||
def lock(self):
|
||||
def lock(self, caller='Kylin System Updater'):
|
||||
"""
|
||||
Send a dbus signal to logind to not suspend the system, it will be
|
||||
released when the return value drops out of scope
|
||||
|
@ -955,7 +971,7 @@ class InhibitShutdownLock():
|
|||
'org.freedesktop.login1.Manager', 'Inhibit',
|
||||
GLib.Variant('(ssss)',
|
||||
('shutdown',
|
||||
'Kylin System Updater', 'Installing Packages',
|
||||
caller, 'Installing Packages',
|
||||
'block')),
|
||||
None, 0, -1, None, None)
|
||||
self.inhibit_lock = Gio.UnixInputStream(fd=fdlist.steal_fds()[var[0]])
|
||||
|
|
|
@ -164,7 +164,7 @@ class InstallBackend():
|
|||
# if self.action_mode == self.MODE_INSTALL_SINGLE:
|
||||
# logging.warning("MODE_INSTALL_SINGLE install:%s , upgrade:%s remove:%s",str(pkgs_install),str(pkgs_upgrade),str(pkgs_remove))
|
||||
|
||||
self.window_main.update_essential.check(pkgs_remove)
|
||||
self.window_main.update_essential.check_essential(pkgs_remove)
|
||||
|
||||
#检查磁盘的状态
|
||||
self.check_free_space(self.cache)
|
||||
|
@ -210,6 +210,7 @@ class InstallBackend():
|
|||
logging.warning("Simulation of the deletion package list:%s",str(delete_pkgs))
|
||||
logging.warning("ProblemResolver of the deletion package list:%s",str(pkgs_remove))
|
||||
delete_desc = []
|
||||
self.window_main.update_essential.check_white(pkgs_remove)
|
||||
else:
|
||||
pkgs_remove = delete_pkgs
|
||||
else:
|
||||
|
@ -258,7 +259,7 @@ class InstallBackend():
|
|||
self.fix_incomplete()
|
||||
#卸载包
|
||||
elif self.action == self.ACTION_REMOVE_PACKAGES:
|
||||
# self._start_install_lock()
|
||||
self._start_install_lock()
|
||||
self.purge_packages(partial_upgrade_list)
|
||||
elif self.action == self.ACTION_CLEAN:
|
||||
self.clean()
|
||||
|
@ -274,11 +275,11 @@ class InstallBackend():
|
|||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
def start_alone(self,partial_upgrade_list = [],_is_install = False):
|
||||
def start_alone(self,partial_upgrade_list = [],_is_install = False, caller=''):
|
||||
# 安装本地deb包的接口
|
||||
if self.action == self.ACTION_INSTALL_DEB:
|
||||
try:
|
||||
# self._start_install_lock()
|
||||
self._start_install_lock(caller=caller)
|
||||
self.install_deb(install_path = partial_upgrade_list, install_force = _is_install)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
@ -710,11 +711,11 @@ class InstallBackend():
|
|||
logging.warning("fix incomplete install failed.")
|
||||
|
||||
elif action == self.ACTION_REMOVE_PACKAGES:
|
||||
# self._release_install_lock()
|
||||
self._release_install_lock()
|
||||
self.window_main.dbusController.PurgePackagesFinished(success,error_string,error_desc)
|
||||
|
||||
elif action == self.ACTION_INSTALL_DEB:
|
||||
# self._release_install_lock()
|
||||
self._release_install_lock()
|
||||
#FIXME: '\r\n: \r\n\r\n'就认为是验证失败
|
||||
if success == False and '\r\n: \r\n\r\n' in self.aptd_base.error_details:
|
||||
error_string = _("Package validation failed and installation was rejected.")
|
||||
|
@ -741,9 +742,9 @@ class InstallBackend():
|
|||
|
||||
self.window_main.dbusController.UpdateInstallFinished(success,self.now_upgrade.upgrade_content,error_string,error_desc)
|
||||
|
||||
def _start_install_lock(self):
|
||||
def _start_install_lock(self, caller='Kylin System Updater'):
|
||||
self.window_main.configs_uncover.setValue("SystemStatus","abnormal_reboot",str(True))
|
||||
self.window_main.inhibit_shutdown.lock()
|
||||
self.window_main.inhibit_shutdown.lock(caller=caller)
|
||||
|
||||
def _release_install_lock(self):
|
||||
self.window_main.configs_uncover.setValue("SystemStatus","abnormal_reboot",str(False))
|
||||
|
@ -790,7 +791,7 @@ class InstallBackend():
|
|||
pkgs_install = data["pkgs_install"]
|
||||
pkgs_upgrade = data["pkgs_upgrade"]
|
||||
pkgs_remove = data["pkgs_remove"]
|
||||
except json.JSONDecodeError as exc:
|
||||
except Exception as exc:
|
||||
logging.error(exc)
|
||||
|
||||
return NowUpgradeMeta(self,upgrade_groups,single_pkgs),pkgs_install,pkgs_upgrade,pkgs_remove
|
||||
|
|
|
@ -17,7 +17,7 @@ cat updaterlog/base-info
|
|||
cp /etc/apt/sources.list updaterlog || true
|
||||
|
||||
cp -r /etc/apt/sources.list.d/ updaterlog || true
|
||||
cp -r /etc/apt/apt.conf.d / updaterlog || true
|
||||
cp -r /etc/apt/apt.conf.d/ updaterlog || true
|
||||
|
||||
#复制后端的日志
|
||||
cp -r /var/log/kylin-system-updater/ updaterlog || true
|
||||
|
@ -40,7 +40,7 @@ cp /var/log/apt-p2p.log updaterlog || true
|
|||
#收集aptdamon的日志
|
||||
cp -r /var/log/kylin-unattended-upgrades/ updaterlog || true
|
||||
|
||||
outputName="$(date +%m-%d,%H:%M:%S)-updaterLog.tar.gz"
|
||||
outputName="$(date +%m-%d,%H-%M-%S)-updaterLog.tar.gz"
|
||||
|
||||
#将所有的日志进行打包
|
||||
tar -czvf updaterLog.tar.gz updaterlog >/dev/null
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
kylin-system-updater (2.0.5.2) v101; urgency=medium
|
||||
|
||||
* BUG: 124775 【应用商店】卸载应用的授权弹窗显示为英文(必现)
|
||||
* BUG: #118026 【在线更新】英文环境下,安装和卸载应用时弹出授权界面,提示内容表述方式不一致
|
||||
#125182 【安装器】在安全中心将应用程序来源检查设置为阻止,双击安装未签名deb包,安装失败但是日志为空
|
||||
#126365 【安装器】英文状态下授权窗口未中文
|
||||
#126787 【离线更新】光盘源/U盘源插入被测机器,控制面板-更新界面提示软件源更新失败
|
||||
#124430 【在线更新】控制面板-更新中“自动下载和安装更新”按钮未与配置文件进行联动
|
||||
#120948 【在线更新】断网时检测更新失败的文案何设计图不符
|
||||
* 需求号: 无
|
||||
* 其他改动说明: 无
|
||||
* 其他改动影响域:系统更新
|
||||
|
||||
-- luoxueyi <luoxueyi@kylinos.cn> Tue, 28 Jun 2022 18:09:38 +0800
|
||||
-- luoxueyi <luoxueyi@kylinos.cn> Thu, 07 Jul 2022 17:27:22 +0800
|
||||
|
||||
kylin-system-updater (2.0.5.1) v101; urgency=medium
|
||||
|
||||
|
|
|
@ -41,7 +41,9 @@ Depends: ${python3:Depends},
|
|||
python3-distro-info,
|
||||
python3-apscheduler,
|
||||
python3-pyqt5,
|
||||
sqlite3
|
||||
python3-crypto,
|
||||
sqlite3,
|
||||
kylin-update-frontend
|
||||
Breaks:
|
||||
Recommends: python3-launchpadlib
|
||||
Suggests: gir1.2-dbusmenu-glib-0.4,
|
||||
|
|
Loading…
Reference in New Issue