Merge branch 'backend_dev' of gitlab2.kylin.com:kylin-desktop/update-manager-group/kylin-system-updater into backend_dev
This commit is contained in:
commit
1411e9bff8
11
README.MD
11
README.MD
|
@ -12,7 +12,8 @@
|
|||
|
||||
- backend_dev:后端更新代码维护的分支
|
||||
- plugin_dev:控制面板插件维护的分支
|
||||
- dev:分支只要负责将后端更新代码和插件的代码进行合并测试的分支,最新的代码在此分支上
|
||||
- dev:分支只要负责将后端更新代码和插件的代码进行合并编包测试的分支,最新的代码在此分支上
|
||||
- master:负责最终出版本的分支,dev上验证成功后,将代码合并到master上进行编包
|
||||
|
||||
|
||||
|
||||
|
@ -22,7 +23,13 @@
|
|||
sudo apt install dh-python python3-all python3-distutils-extra gir1.2-snapd-1 apt-clone intltool at-spi2-core -y
|
||||
```
|
||||
|
||||
- 运行运行
|
||||
-
|
||||
|
||||
|
||||
|
||||
### 后端服务:
|
||||
|
||||
- 后端服务主要负责更新、安装、升级等等各种安装和下载的过程处理,
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -267,6 +267,10 @@ class UpdateList():
|
|||
|
||||
def _make_groups_upgrade(self,cache,group_list, pkgs_upgrade = []):
|
||||
try:
|
||||
if os.path.isdir(INPUT_CONFIG_PATH) == False:
|
||||
logging.warning("configPath(%s) is not exists...",INPUT_CONFIG_PATH)
|
||||
return
|
||||
|
||||
files = os.listdir(INPUT_CONFIG_PATH) #获得文件夹中所有文件的名称列表
|
||||
|
||||
for ifile in files:
|
||||
|
|
|
@ -182,39 +182,43 @@ class UpdateManager():
|
|||
|
||||
def check_group_config(self,cache):
|
||||
_success = True
|
||||
header = None
|
||||
desc = None
|
||||
header = ''
|
||||
desc = ''
|
||||
#2、 安装JSON分组配置文件包 安装完毕会重新调start_available --> here 安装失败就直接退出不会进行下面的操作
|
||||
try:
|
||||
pkg_json = cache[GROUPS_PKG_NAME]
|
||||
#是否安装
|
||||
if pkg_json.is_installed:
|
||||
#是否可升级
|
||||
if pkg_json.is_upgradable:
|
||||
logging.info("groups JSON ConfigPkgs(%s) start upgrading...",GROUPS_PKG_NAME)
|
||||
pkg_json.mark_upgrade()
|
||||
if GROUPS_PKG_NAME in cache:
|
||||
pkg_json = cache[GROUPS_PKG_NAME]
|
||||
#是否安装
|
||||
if pkg_json.is_installed:
|
||||
#是否可升级
|
||||
if pkg_json.is_upgradable:
|
||||
logging.info("groups JSON ConfigPkgs(%s) start upgrading...",GROUPS_PKG_NAME)
|
||||
pkg_json.mark_upgrade()
|
||||
|
||||
self.start_install(MODE_UPGRADE_SINGLE,True)
|
||||
#直接退出
|
||||
_success = False
|
||||
header = INSTALL_ALONE_PROGRESS
|
||||
return _success,header,desc
|
||||
else:
|
||||
logging.info("ConfigPkgs(%s) No need to upgrade...",GROUPS_PKG_NAME)
|
||||
else:
|
||||
logging.info("groups JSON ConfigPkgs(%s) start new installing...",GROUPS_PKG_NAME)
|
||||
pkg_json.mark_install()
|
||||
self.start_install(MODE_UPGRADE_SINGLE,True)
|
||||
#直接退出
|
||||
_success = False
|
||||
header = INSTALL_ALONE_PROGRESS
|
||||
return _success,header,desc
|
||||
else:
|
||||
logging.info("ConfigPkgs(%s) No need to upgrade...",GROUPS_PKG_NAME)
|
||||
else:
|
||||
logging.info("groups JSON ConfigPkgs(%s) start new installing...",GROUPS_PKG_NAME)
|
||||
pkg_json.mark_install()
|
||||
self.start_install(MODE_UPGRADE_SINGLE,True)
|
||||
#直接退出
|
||||
header = _("Preparing the upgrade failed")
|
||||
desc = _("groups JSON ConfigPkgs install failed")
|
||||
logging.error("groups JSON ConfigPkgs(%s) install failed...",GROUPS_PKG_NAME)
|
||||
_success = False
|
||||
header = INSTALL_ALONE_PROGRESS
|
||||
return _success,header,desc
|
||||
return _success,header,desc
|
||||
|
||||
#FIXME: 错误处理未做 报告到控制面板
|
||||
except Exception as e:
|
||||
header = _("Preparing the upgrade failed")
|
||||
desc = _("groups JSON ConfigPkgs install failed")
|
||||
logging.error("groups JSON ConfigPkgs(%s) install failed...",GROUPS_PKG_NAME)
|
||||
logging.error(e)
|
||||
_success = False
|
||||
return _success,header,desc
|
||||
|
@ -279,7 +283,7 @@ class UpdateManager():
|
|||
|
||||
#检查更新分组配置表
|
||||
_success,header,desc = self.check_group_config(self.cache)
|
||||
if _success == False:
|
||||
if _success == False and self.configs.getWithDefault("ConfigPkgStatus", "mustexistconfigpkg", True) == True:
|
||||
return _success,header,desc
|
||||
|
||||
try:
|
||||
|
|
|
@ -63,6 +63,7 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
lock = threading.Lock()
|
||||
bus = dbus.SystemBus()
|
||||
try:
|
||||
logging.info("start to update Source Template...")
|
||||
obj = bus.get_object('com.kylin.software.properties', '/com/kylin/software/properties')
|
||||
interface = dbus.Interface(obj, dbus_interface='com.kylin.software.properties.interface')
|
||||
lock.acquire()
|
||||
|
@ -133,8 +134,8 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
logging.warning('Clean In the process of updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
else:
|
||||
self.parent.start_clean()
|
||||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' Clean ...')
|
||||
self.parent.start_clean()
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
@ -158,8 +159,8 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
logging.warning('FixBrokenDepends In the process of updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
else:
|
||||
self.parent.start_fix_broken()
|
||||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' FixBrokenDepends ...')
|
||||
self.parent.start_fix_broken()
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
@ -173,8 +174,8 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
logging.warning('FixIncompleteInstall In the process of updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
else:
|
||||
self.parent.start_fix_incomplete()
|
||||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' FixIncompleteInstall ...')
|
||||
self.parent.start_fix_incomplete()
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
@ -188,8 +189,8 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
logging.warning('UpdateDetect In the process of updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
else:
|
||||
self.parent.start_update()
|
||||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' UpdateDetect ...')
|
||||
self.parent.start_update()
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
|
|
@ -12,7 +12,7 @@ from aptdaemon.enums import (EXIT_SUCCESS,
|
|||
from SystemUpdater.backend import InstallBackend
|
||||
import logging
|
||||
from gettext import gettext as _
|
||||
|
||||
from ..Core.utils import humanize_size
|
||||
import dbus,time
|
||||
from gi.repository import GLib
|
||||
|
||||
|
@ -285,10 +285,22 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
current_items, total_items, \
|
||||
currenty_bytes, total_bytes, \
|
||||
current_cps)
|
||||
else:
|
||||
if self.action == self.ACTION_UPDATE:
|
||||
return
|
||||
logging.info("Other Action:current_items = %d, total_items = %d, currenty_bytes = %s, total_bytes = %s, current_cps = %s/s",\
|
||||
current_items, total_items, \
|
||||
humanize_size(currenty_bytes), humanize_size(total_bytes),\
|
||||
humanize_size(current_cps))
|
||||
|
||||
def _on_cancellable_changed(self, trans, Cancelable):
|
||||
self.window_main.dbusController.Cancelable(Cancelable)
|
||||
|
||||
#增加记录当产生错误的时候 详细信息
|
||||
def _on_error_changed(self, trans,error_code, error_details):
|
||||
# error_string = get_error_string_from_enum(error_code)
|
||||
logging.error(str(error_details))
|
||||
|
||||
@inline_callbacks
|
||||
def _show_transaction(self, trans, action, header, show_details):
|
||||
#更新和升级最后完成和失败都会走此在此进行完成之后的处理
|
||||
|
@ -301,6 +313,7 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
#下载的进度信息
|
||||
trans.connect("progress-details-changed", self._on_progress_download_changed)
|
||||
trans.connect("status-details-changed", self._on_details_changed)
|
||||
trans.connect("error", self._on_error_changed)
|
||||
# yield trans.set_debconf_frontend("ukui")
|
||||
yield trans.run()
|
||||
|
||||
|
|
|
@ -4,3 +4,6 @@ upgradelist =
|
|||
[SystemStatus]
|
||||
isabnormalreboot = False
|
||||
|
||||
[ConfigPkgStatus]
|
||||
mustexistconfigpkg = True
|
||||
|
||||
|
|
|
@ -66,6 +66,9 @@ if __name__ == "__main__":
|
|||
logging.info('kylin-system-updater starting ...')
|
||||
|
||||
app = UpdateManager(options)
|
||||
# app.start_update()
|
||||
|
||||
#当出现安装过程中异常的重启时 直接开机直接进行修复操作
|
||||
if app.configs.getWithDefault("SystemStatus", "isabnormalreboot", False) == True:
|
||||
app.start_update()
|
||||
|
||||
app.run()
|
Loading…
Reference in New Issue