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

This commit is contained in:
Xueyi Luo 2022-04-27 14:45:00 +08:00
commit 99cc4e5633
7 changed files with 32 additions and 25 deletions

View File

@ -62,10 +62,8 @@ class UpdateList():
self.application_dirs = [os.path.join(base, 'applications')
for base in data_dirs.split(':')]
#是否关闭源过滤
# if (parent.options.close_filter == True or parent.configs.getWithDefault("SystemStatus", "isclosefilter", False) == True) and self.parent.is_disc_source == True:
if self.parent.options.close_filter == False and self.parent.is_disc_source == False:
if self.parent.options.close_filter == False and self.parent.is_disc_source == False and \
self.parent.configs.getWithDefault("SystemStatus", "close_source_filter", False) == False :
#开启原过滤
self.is_close_filter = False
self.fu = UpdateListFilterCache(self.parent)

View File

@ -107,6 +107,6 @@ class UpgradeConfig(SafeConfigParser):
if __name__ == "__main__":
# c = UpgradeConfig("/home/x/share/kylin-system-updater/backend/data/")
# print(c.setValue("SystemStatus", "isabnormalreboot", str(False)),True)
# print(c.getWithDefault("SystemStatus", "isabnormalreboot", False))
# print(c.setValue("SystemStatus", "abnormal_reboot", str(False)),True)
# print(c.getWithDefault("SystemStatus", "abnormal_reboot", False))
pass

View File

@ -416,9 +416,9 @@ class UpdateManager():
self.update_list = UpdateList(self)
#1、 检查出现安装过程异常重启 出现的话 进行异常修复
if self.configs.getWithDefault("SystemStatus", "isabnormalreboot", False) == True:
if self.configs.getWithDefault("SystemStatus", "abnormal_reboot", False) == True:
header = self.INSTALL_ALONE_PROGRESS
self.configs.setValue("SystemStatus","isabnormalreboot",str(False),True)
self.configs.setValue("SystemStatus","abnormal_reboot",str(False),True)
logging.warning("start fix Abnormal Reboot broken pkgs...")
self.start_fix_broken()
return False,header,desc
@ -481,14 +481,22 @@ class UpdateManager():
#控制面板前端包的检查升级
if self.FRONTEND_PKG_NAME in cache:
self_pkg = cache[self.FRONTEND_PKG_NAME]
#是否安装
if self_pkg.is_installed and self_pkg.is_upgradable:
logging.info("Check: Frontend(%s) start upgrading From %s to %s...",self.FRONTEND_PKG_NAME,\
self_pkg.installed.source_version,self_pkg.candidate.source_version)
self_pkg.mark_install()
need_upgrade = True
if self_pkg.is_installed:
#是否可升级
if self_pkg.is_upgradable:
logging.info("Check: Frontend(%s) start upgrading From %s to %s...",self.FRONTEND_PKG_NAME,\
self_pkg.installed.source_version,self_pkg.candidate.source_version)
self_pkg.mark_install()
need_upgrade = True
else:
logging.info("Check: Frontend(%s:%s) No need to upgrade...",self.FRONTEND_PKG_NAME,self_pkg.installed.source_version)
else:
logging.info("Check: Frontend(%s:%s) No need to upgrade...",self.FRONTEND_PKG_NAME,self_pkg.installed.source_version)
self.dbusController.UpdateDetectStatusChanged(95,_("Group configuration being updated"))
logging.info("Check: Frontend(%s) start new installing...",self.FRONTEND_PKG_NAME)
self_pkg.mark_install()
self.configs.setValue("ConfigPkgStatus","check_frontend_pkg",str(False),True)
need_upgrade = True
else:
#没有在cache中就认为不需要升级
logging.error("Check: Frontend(%s) The upgrade package is not in Cache...",self.FRONTEND_PKG_NAME)

View File

@ -345,7 +345,7 @@ class InstallBackendAptdaemon(InstallBackend):
LockedPreventShutdown()
#进度安装阶段标志位,使用鉴别是否出现安装过程中强制关闭 之后进行修复使用得
self.window_main.configs.setValue("SystemStatus","isabnormalreboot",str(True),True)
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(True),True)
#只处理从下载切换到安装时出现的网络问题
#当网络波动时下载某些软件包失败时属于异常状态进行重试时 不发送后续进度 等待重试正常是 进行下载安装

View File

@ -159,7 +159,7 @@ class InstallBackend():
try:
#进度安装阶段标志位,使用鉴别是否出现安装过程中强制关闭 之后进行修复使用得
self.window_main.configs.setValue("SystemStatus","isabnormalreboot",str(True),True)
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(True),True)
self.commit(self.action,pkgs_install, pkgs_upgrade, pkgs_remove)
except Exception as e:
logging.error(e)
@ -219,7 +219,7 @@ class InstallBackend():
#补充删除描述
if pkgs_remove != [] and delete_desc == []:
for pkg in pkgs_remove:
delete_desc.append("依赖计算器计算结果")
delete_desc.append(' ')
#解锁后端状态
self.window_main.is_working = self.ACTION_DEFUALT_STATUS
@ -482,7 +482,7 @@ class InstallBackend():
#升级完成后走的分支
if action == self.ACTION_INSTALL:
#记录这个过程中是否关机
self.window_main.configs.setValue("SystemStatus","isabnormalreboot",str(False),True)
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(False),True)
#解锁 禁止关机
unLockedEnableShutdown()
@ -505,7 +505,6 @@ class InstallBackend():
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc)
#升级本身完成后 退出 有systemd 来进行重启服务
self.window_main.dbusController.Quit(None)
return
#当单包升级的时候 升级本身时,让程序退出,再重新启动
if self.window_main.GROUPS_PKG_NAME in self.cache and self.cache[self.window_main.GROUPS_PKG_NAME] in self.cache.get_changes():
@ -568,7 +567,7 @@ class InstallBackend():
self.window_main.only_update_cache()
elif action == self.ACTION_INSTALL_SHUTDOWN:
self.window_main.configs.setValue("SystemStatus","isabnormalreboot",str(False))
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(False))
if success == True:
#当升级完成时 将手动和自动安装的标志位全部清空

View File

@ -2,12 +2,13 @@
upgradelist =
[SystemStatus]
isabnormalreboot = False
isclosefilter = False
abnormal_reboot = False
close_source_filter = False
[ConfigPkgStatus]
check_selfupgrade = True
check_resover_remove = True
check_resover_remove = False
check_frontend_pkg = True
[InstallMode]
shutdown_install = True

View File

@ -88,7 +88,8 @@ if __name__ == "__main__":
app = UpdateManager(options)
#当出现安装过程中异常的重启时 开机直接进行修复操作
if app.configs.getWithDefault("SystemStatus", "isabnormalreboot", False) == True:
if app.configs.getWithDefault("SystemStatus", "abnormal_reboot", False) == True or \
app.configs.getWithDefault("ConfigPkgStatus", "check_frontend_pkg", False) == True:
app.start_update()
app.run()