Merge branch 'backend_manual' into 'yhkylin/v101'
Backend manual See merge request kylinos-src/update-manager-group/kylin-system-updater!523
This commit is contained in:
commit
c14cf23610
|
@ -220,218 +220,221 @@ class Sqlite3Server(object):
|
|||
status_cn = '失败'
|
||||
changeLog = ""
|
||||
|
||||
# 判断更新方式
|
||||
if mode == InstallBackend.MODE_INSTALL_PARTIAL: # 部分更新
|
||||
pkg_adj = ""
|
||||
# 判断更新包为单包或更新组
|
||||
if pkg_group:
|
||||
# 更新组
|
||||
pkgname = pkg_group.pop(0)
|
||||
pkgversion,pkgdescription,appname_cn = self.GetGroupmsg(pkgname)
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(pkgname)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(pkgname)})
|
||||
if pkgname in self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'][pkgname])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
|
||||
# 系统升级完成 ..判断版本号
|
||||
if status == "success" and "kylin-update-desktop-system" in pkgname:
|
||||
# 更新版本号
|
||||
if "=" in str(pkgversion):
|
||||
pkgversion = str(pkgversion).split('=')[-1]
|
||||
logging.info("Complete system upgrade, refresh system version ...")
|
||||
self._refresh_system_version(pkgversion)
|
||||
#移除step-two标记
|
||||
self._removal_of_marker()
|
||||
try:
|
||||
# 判断更新方式
|
||||
if mode == InstallBackend.MODE_INSTALL_PARTIAL: # 部分更新
|
||||
pkg_adj = ""
|
||||
# 判断更新包为单包或更新组
|
||||
if pkg_group:
|
||||
# 更新组
|
||||
pkgname = pkg_group.pop(0)
|
||||
pkgversion,pkgdescription,appname_cn = self.GetGroupmsg(pkgname)
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(pkgname)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(pkgname)})
|
||||
if pkgname in self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'][pkgname])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
|
||||
# 系统升级完成 ..判断版本号
|
||||
if status == "success" and "kylin-update-desktop-system" in pkgname:
|
||||
# 更新版本号
|
||||
if "=" in str(pkgversion):
|
||||
pkgversion = str(pkgversion).split('=')[-1]
|
||||
logging.info("Complete system upgrade, refresh system version ...")
|
||||
self._refresh_system_version(pkgversion)
|
||||
#移除step-two标记
|
||||
self._removal_of_marker()
|
||||
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
file_path = os.path.join(get_config_patch(), str(pkgname) + ".yaml")
|
||||
with open(file_path, "r") as stream:
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
file_path = os.path.join(get_config_patch(), str(pkgname) + ".yaml")
|
||||
with open(file_path, "r") as stream:
|
||||
try:
|
||||
data_yaml = yaml.safe_load(stream)
|
||||
changeLog = data_yaml['changelog']
|
||||
except yaml.YAMLError as exc:
|
||||
logging.error(exc)
|
||||
elif pkg_list:
|
||||
changeLog = " "
|
||||
# 单包更新 # 获取单包数据插入数据库
|
||||
pkgname = pkg_list.pop(0)
|
||||
for adj in adjust_pkg:
|
||||
if pkgname in adj:
|
||||
# 该部分升级的单包为调整版本,与候选版本不一致
|
||||
pkg_adj = adj
|
||||
break
|
||||
if pkg_adj: # 有调整的情况
|
||||
try:
|
||||
pkg = self.window_main.cache[pkg_adj.split("=")[0]]
|
||||
for ver in pkg.versions:
|
||||
if ver.version == pkg_adj.split("=")[1]:
|
||||
pkg_inst_ver = ver
|
||||
break
|
||||
pkgname = pkg_adj.split("=")[0]
|
||||
pkgversion = str(pkg_inst_ver.source_version)
|
||||
pkgdescription = str(pkg_inst_ver.description)
|
||||
except Exception as e:
|
||||
logging.error(_("%s could not be detected in the source because the source was changed or for other reasons."), \
|
||||
str(pkgname))
|
||||
logging.error(str(e))
|
||||
else: # 没有调整的情况
|
||||
try:
|
||||
pkg = self.window_main.cache[pkgname]
|
||||
pkgversion = str(pkg.candidate.version)
|
||||
pkgdescription = str(pkg.candidate.raw_description)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(pkgname)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(pkgname)})
|
||||
if pkgname in self.window_main.update_list.upgrade_meta.versoin_pkgs['single_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['single_upgrade'][pkgname])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
|
||||
# 软件商店获取中文名
|
||||
appname_cn = self.get_cn_appname(str(pkgname))
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
try:
|
||||
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
# FIXME: 发送插入数据库成功的信号local_upgrade_list
|
||||
self.window_main.dbusController.UpdateSqlitSingle(pkgname, timestr)
|
||||
# 数据库文件被删除或者新增字段导致需要重新初始化数据库再写入
|
||||
except Exception as e:
|
||||
self.init_sqlit()
|
||||
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
# FIXME: 这里也需要, 发送插入数据库成功的信号
|
||||
self.window_main.dbusController.UpdateSqlitSingle(pkgname, timestr)
|
||||
elif mode == InstallBackend.MODE_INSTALL_ALL: # 系统全部升级
|
||||
# # insert signal deb first
|
||||
for i in pkg_list:
|
||||
changeLog = ""
|
||||
try:
|
||||
data_yaml = yaml.safe_load(stream)
|
||||
changeLog = data_yaml['changelog']
|
||||
except yaml.YAMLError as exc:
|
||||
logging.error(exc)
|
||||
elif pkg_list:
|
||||
changeLog = " "
|
||||
# 单包更新 # 获取单包数据插入数据库
|
||||
pkgname = pkg_list.pop(0)
|
||||
for adj in adjust_pkg:
|
||||
if pkgname in adj:
|
||||
# 该部分升级的单包为调整版本,与候选版本不一致
|
||||
pkg_adj = adj
|
||||
break
|
||||
if pkg_adj: # 有调整的情况
|
||||
try:
|
||||
pkg = self.window_main.cache[pkg_adj.split("=")[0]]
|
||||
for ver in pkg.versions:
|
||||
if ver.version == pkg_adj.split("=")[1]:
|
||||
pkg_inst_ver = ver
|
||||
break
|
||||
pkgname = pkg_adj.split("=")[0]
|
||||
pkgversion = str(pkg_inst_ver.source_version)
|
||||
pkgdescription = str(pkg_inst_ver.description)
|
||||
pkg = self.window_main.cache[i]
|
||||
except Exception as e:
|
||||
logging.error(_("%s could not be detected in the source because the source was changed or for other reasons."), \
|
||||
str(pkgname))
|
||||
logging.error(str(e))
|
||||
else: # 没有调整的情况
|
||||
str(i))
|
||||
continue
|
||||
if not pkg:
|
||||
continue
|
||||
pkgversion = str(pkg.candidate.version)
|
||||
pkgdescription = str(pkg.candidate.raw_description)
|
||||
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(pkg.name)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(pkg.name)})
|
||||
if pkg.name in self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'][pkg.name])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
|
||||
|
||||
try:
|
||||
pkg = self.window_main.cache[pkgname]
|
||||
pkgversion = str(pkg.candidate.version)
|
||||
pkgdescription = str(pkg.candidate.raw_description)
|
||||
# 软件商店获取中文名
|
||||
appname_cn = self.get_cn_appname(str(i))
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
# 数据库文件被删除或者新增字段导致需要重新初始化数据库再写入
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(pkgname)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(pkgname)})
|
||||
if pkgname in self.window_main.update_list.upgrade_meta.versoin_pkgs['single_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['single_upgrade'][pkgname])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
|
||||
# 软件商店获取中文名
|
||||
appname_cn = self.get_cn_appname(str(pkgname))
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
try:
|
||||
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
# FIXME: 发送插入数据库成功的信号local_upgrade_list
|
||||
self.window_main.dbusController.UpdateSqlitSingle(pkgname, timestr)
|
||||
# 数据库文件被删除或者新增字段导致需要重新初始化数据库再写入
|
||||
except Exception as e:
|
||||
self.init_sqlit()
|
||||
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
# FIXME: 这里也需要, 发送插入数据库成功的信号
|
||||
self.window_main.dbusController.UpdateSqlitSingle(pkgname, timestr)
|
||||
elif mode == InstallBackend.MODE_INSTALL_ALL: # 系统全部升级
|
||||
# # insert signal deb first
|
||||
for i in pkg_list:
|
||||
changeLog = ""
|
||||
try:
|
||||
pkg = self.window_main.cache[i]
|
||||
except Exception as e:
|
||||
logging.error(_("%s could not be detected in the source because the source was changed or for other reasons."), \
|
||||
str(i))
|
||||
continue
|
||||
if not pkg:
|
||||
continue
|
||||
pkgversion = str(pkg.candidate.version)
|
||||
pkgdescription = str(pkg.candidate.raw_description)
|
||||
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(pkg.name)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(pkg.name)})
|
||||
if pkg.name in self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'][pkg.name])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
|
||||
|
||||
try:
|
||||
# 软件商店获取中文名
|
||||
appname_cn = self.get_cn_appname(str(i))
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
# 数据库文件被删除或者新增字段导致需要重新初始化数据库再写入
|
||||
except Exception as e:
|
||||
self.init_sqlit()
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
# insert group deb next
|
||||
for i in pkg_group:
|
||||
# FIXME: 获取组信息
|
||||
pkgversion,pkgdescription,appname_cn = self.GetGroupmsg(i)
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(i)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(i)})
|
||||
if i in self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'][i])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
json_file = json.dumps(InstallInfos.copy())
|
||||
try:
|
||||
self.window_main.collector.UpdateMsg("InstallInfos", json_file)
|
||||
except:
|
||||
pass
|
||||
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
file_path = os.path.join(get_config_patch(), str(pkgname) + ".yaml")
|
||||
with open(file_path, "r") as stream:
|
||||
self.init_sqlit()
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
# insert group deb next
|
||||
for i in pkg_group:
|
||||
# FIXME: 获取组信息
|
||||
pkgversion,pkgdescription,appname_cn = self.GetGroupmsg(i)
|
||||
#更新信息update-infos
|
||||
UpdateInfos.update({"appname":str(i)})
|
||||
UpdateInfos.update({"source":"Kylin System Updater"})
|
||||
UpdateInfos.update({"status":status})
|
||||
UpdateInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
self.window_main.collector.Upgrade_Process_Msg("finish-update", UpdateInfos.copy())
|
||||
#安装信息install-infos
|
||||
InstallInfos.update({"appname":str(i)})
|
||||
if i in self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'].keys():
|
||||
InstallInfos.update({"old_version":str(self.window_main.update_list.upgrade_meta.versoin_pkgs['groups_upgrade'][i])})
|
||||
else:
|
||||
InstallInfos.update({"old_version":'UnKnown'})
|
||||
InstallInfos.update({"new_version":str(pkgversion)})
|
||||
InstallInfos.update({"status":status})
|
||||
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
|
||||
json_file = json.dumps(InstallInfos.copy())
|
||||
try:
|
||||
data_yaml = yaml.safe_load(stream)
|
||||
changeLog = data_yaml['changelog']
|
||||
except yaml.YAMLError as exc:
|
||||
logging.error(exc)
|
||||
try:
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
# 数据库文件被删除或者新增字段导致需要重新初始化数据库再写入
|
||||
except Exception as e:
|
||||
self.init_sqlit()
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
|
||||
# 系统升级完成 ..判断版本号
|
||||
if status == "success" and "kylin-update-desktop-system" in pkg_group:
|
||||
self.window_main.collector.UpdateMsg("InstallInfos", json_file)
|
||||
except:
|
||||
pass
|
||||
|
||||
#FIXME: 临时方案 PHP
|
||||
PHPSeverSend(_appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
|
||||
file_path = os.path.join(get_config_patch(), str(i) + ".yaml")
|
||||
with open(file_path, "r") as stream:
|
||||
try:
|
||||
data_yaml = yaml.safe_load(stream)
|
||||
changeLog = data_yaml['changelog']
|
||||
except yaml.YAMLError as exc:
|
||||
logging.error(exc)
|
||||
try:
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
# 数据库文件被删除或者新增字段导致需要重新初始化数据库再写入
|
||||
except Exception as e:
|
||||
self.init_sqlit()
|
||||
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
|
||||
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
|
||||
|
||||
# 系统升级完成 ..判断版本号
|
||||
if status == "success" and "kylin-update-desktop-system" in pkg_group:
|
||||
# 更新版本号
|
||||
if "=" in str(pkgversion):
|
||||
pkgversion = str(pkgversion).split('=')[-1]
|
||||
logging.info("Complete system upgrade, refresh system version ...")
|
||||
self._refresh_system_version(str(pkgversion))
|
||||
#移除step-two标记
|
||||
self._removal_of_marker()
|
||||
|
||||
elif mode == InstallBackend.MODE_INSTALL_SYSTEM: # 全盘升级
|
||||
self.insert_into_updateinfo(_("Upgrade System"), "", "This is a complete system upgrade, equivalent to the implementation of apt dist-upgrade", timestr, status, "1", errstr, str("全盘升级"), status_cn, " ")
|
||||
self.window_main.dbusController.UpdateSqlitSingle("Upgrade System", timestr)
|
||||
# 全盘更新完成 ..判断版本号
|
||||
if status == "success":
|
||||
# 更新版本号
|
||||
if "=" in str(pkgversion):
|
||||
pkgversion = str(pkgversion).split('=')[-1]
|
||||
logging.info("Complete system upgrade, refresh system version ...")
|
||||
self._refresh_system_version(str(pkgversion))
|
||||
self._refresh_system_version(pseudo_version=True)
|
||||
#移除step-two标记
|
||||
self._removal_of_marker()
|
||||
|
||||
elif mode == InstallBackend.MODE_INSTALL_SYSTEM: # 全盘升级
|
||||
self.insert_into_updateinfo(_("Upgrade System"), "", "This is a complete system upgrade, equivalent to the implementation of apt dist-upgrade", timestr, status, "1", errstr, str("全盘升级"), status_cn, " ")
|
||||
self.window_main.dbusController.UpdateSqlitSingle("Upgrade System", timestr)
|
||||
# 全盘更新完成 ..判断版本号
|
||||
if status == "success":
|
||||
# 更新版本号
|
||||
self._refresh_system_version(pseudo_version=True)
|
||||
#移除step-two标记
|
||||
self._removal_of_marker()
|
||||
else:
|
||||
logging.warning("Cache is None.")
|
||||
else:
|
||||
logging.warning("Cache is None.")
|
||||
except Exception as e:
|
||||
logging.error("record update error: %s.",str(e))
|
||||
|
||||
# 获取group信息
|
||||
def GetGroupmsg(self, appname):
|
||||
|
|
|
@ -89,21 +89,66 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
if status == "enable":
|
||||
with open(self.P2P_DEDAULT_PATH, 'w+') as configfile:
|
||||
configfile.write("#enable=true\n")
|
||||
#第一次进行检查是否已经开启
|
||||
args = ["systemctl","is-enabled","apt-p2p.service"]
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
if p.returncode != 0:
|
||||
logging.info("Apt-p2p service is not runing and will be enable...")
|
||||
#第二次进行重启
|
||||
args = ["systemctl","enable","apt-p2p.service"]
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
if p.returncode == 0:
|
||||
logging.info("Service Enable Execute successfully")
|
||||
#第三次进行重启
|
||||
args = ["systemctl","restart","apt-p2p.service"]
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
if p.returncode == 0:
|
||||
logging.info("Restart Execute successfully")
|
||||
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
|
||||
else:
|
||||
logging.error(str(p.stdout))
|
||||
logging.error("Failed to execute reboot")
|
||||
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
|
||||
else:
|
||||
logging.error(str(p.stdout))
|
||||
logging.error("Failed to execute enable")
|
||||
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
|
||||
else:
|
||||
logging.info("Apt-p2p service has been enabled and not need to reabled...")
|
||||
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
|
||||
|
||||
elif status == "disable":
|
||||
with open(self.P2P_DEDAULT_PATH, 'w+') as configfile:
|
||||
configfile.write("enable=false\n")
|
||||
|
||||
args = ["systemctl","is-enabled","apt-p2p.service"]
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
if p.returncode == 0:
|
||||
logging.info("Apt-p2p service is runing and will be disable...")
|
||||
args = ["systemctl","disable","apt-p2p.service"]
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
if p.returncode == 0:
|
||||
logging.info("Service disable Execute successfully")
|
||||
|
||||
args = ["systemctl","stop","apt-p2p.service"]
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
|
||||
if p.returncode == 0:
|
||||
logging.info("Stop Execute successfully")
|
||||
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
|
||||
else:
|
||||
logging.error(str(p.stdout))
|
||||
logging.error("Failed to execute Stop")
|
||||
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
|
||||
else:
|
||||
logging.error(str(p.stdout))
|
||||
logging.error("Failed to execute disable")
|
||||
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
|
||||
else:
|
||||
logging.info("Apt-p2p service has been disabled and not need to redisabled...")
|
||||
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
|
||||
else:
|
||||
logging.waring("error: input value _status=%s",status)
|
||||
|
||||
args = ["systemctl","restart","apt-p2p.service"]
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
logging.info(str(p.stdout))
|
||||
if p.returncode == 0:
|
||||
logging.info("Execute successfully")
|
||||
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
|
||||
else:
|
||||
logging.info("Failed to execute reboot")
|
||||
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
|
||||
else:
|
||||
logging.waring("apt-p2p function is not install...")
|
||||
|
||||
|
|
|
@ -351,7 +351,6 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
self.window_main.dbusController.UpdateDetectStatusChanged(progress,status)
|
||||
elif action == self.ACTION_INSTALL:
|
||||
#50%时候 属于下载状态切换到安装状态的过程 下面的代码只执行一次
|
||||
#Fix 取消的时候进度会直接跳到100 出现判断错误进入安装状态 所以只有在进度51 - 90 之前的一次进度进入安装态
|
||||
if progress >= 50 and progress < 90 and self.on_install_stage == False:
|
||||
logging.info("The process is now in the installtion phase")
|
||||
self.on_install_stage = True
|
||||
|
|
Loading…
Reference in New Issue