Merge branch 'dev' into 'master'

Dev

See merge request wangsong/kylin-system-updater!11
This commit is contained in:
王松 2021-10-15 01:27:17 +00:00
commit 3c26de6b46
5 changed files with 42 additions and 20 deletions

View File

@ -30,7 +30,6 @@ import yaml
import shutil
import apt_pkg
from gi.repository import Gio
from .utils import is_chinese
OUTPUT_CONFIG_PATH = apt_pkg.config.find_dir("Kylin-system-updater::OutputConfigDir",
'/var/lib/kylin-system-updater')

View File

@ -126,6 +126,9 @@ class UpdateManager():
#进行更新的操作
def start_update(self):
try:
#FIXME: 进行两次更新在更新cache之前获取source.list 更新完成之后再进行一次
self.dbusController._on_update_important_list()
self.is_updating = True
update_backend = get_backend(self, InstallBackend.ACTION_UPDATE)
update_backend.start()
@ -135,8 +138,8 @@ class UpdateManager():
#进行升级的操作
def start_install(self,force_install = False,partial_upgrade_list = []):
#检查磁盘的状态
if self.check_free_space(self.cache) == False:
return
# if self.check_free_space(self.cache) == False:
# return
logging.info("Disk Check finished...")
try:
self.is_upgrading = True
@ -148,8 +151,8 @@ class UpdateManager():
#进行升级的操作-传入包列表
def start_install_alone(self,pkgs_install = [], pkgs_upgrade = [], pkgs_remove = [],pkgs_purge = []):
#检查磁盘的状态
if self.check_free_space(self.cache) == False:
return
# if self.check_free_space(self.cache) == False:
# return
logging.info("Disk Check finished...")
self.is_upgrading = True
install_backend = get_backend(self, InstallBackend.ACTION_INSTALL)

View File

@ -33,7 +33,6 @@ class UpdateManagerDbusController(dbus.service.Object):
#更新important.list的本次升级的列表
def _on_update_important_list(self):
_success = True
header = None
desc = None
@ -58,10 +57,10 @@ class UpdateManagerDbusController(dbus.service.Object):
header = _("Get software push failure")
desc = _("Please check the push servers")
logging.warning(header + desc)
return _success,header,desc
return retval,header,desc
else:
logging.info("update sourceTemplate successed...")
return _success,header,desc
return retval,header,desc
#检测网络的状态
def _on_network_alert(self, watcher, state):
@ -263,11 +262,11 @@ class UpdateManagerDbusController(dbus.service.Object):
currenty_bytes, total_bytes,\
current_cps)
#升级完成的信号
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='bbasss')
def UpdateDependResloveStatus(self, resolver_status, remove_status,remove_pkgs,error_string='',error_desc='',):
logging.info("emit UpdateDependResloveStatus:resolver_status = %r , resolver_status = %r , remove_pkgs = %a, error_string = %s , error_desc = %s ",\
resolver_status,remove_status,remove_pkgs, error_string,error_desc)
#查询解决依赖 信号
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='bbasasss')
def UpdateDependResloveStatus(self, resolver_status, remove_status,remove_pkgs,pkg_raw_description,error_string='',error_desc='',):
logging.info("emit UpdateDependResloveStatus:resolver_status = %r , resolver_status = %r , remove_pkgs = %a,pkg_raw_description = %a ,error_string = %s , error_desc = %s ",\
resolver_status,remove_status,remove_pkgs,pkg_raw_description,error_string,error_desc)
# 信号是否可取消
@dbus.service.signal(UPDATER_DBUS_INTERFACE, signature='b')

View File

@ -21,7 +21,6 @@ class InstallBackend():
ACTION_INSTALL = 1
ACTION_INSTALL_DEB = 1
def __init__(self, window_main, action):
self.window_main = window_main
self.action = action
@ -87,6 +86,7 @@ class InstallBackend():
for pkg in pkgs_upgrade:
self.window_main.cache[pkg].mark_upgrade()
#会安装新包和卸载包
Fix.resolve(True)
#不会安装和卸载 只升级
@ -127,10 +127,21 @@ class InstallBackend():
_success,pkgs_install,pkgs_upgrade,pkgs_remove,header,desc = self._make_problem_resolver(partial_upgrade_list)
is_remove_pkgs = len(pkgs_remove) != 0
#属于检测查询依赖解决是否成功 是否存在删包
if force_install == False or _success == False:
self.window_main.is_upgrading = False
self.window_main.dbusController.UpdateDependResloveStatus(_success,is_remove_pkgs,pkgs_remove,header,desc)
raw_description = []
#添加关于删除包的描述信息
for pkg in pkgs_remove:
pkg_obj = self.window_main.cache[pkg]
app = self.window_main.update_list._get_application_for_package(pkg_obj)
if app is not None:
raw_description.append(app.get_display_name())
else:
raw_description.append(getattr(pkg_obj.candidate, "summary", ''))
self.window_main.dbusController.UpdateDependResloveStatus(_success,is_remove_pkgs,pkgs_remove,raw_description,header,desc)
return
try:

View File

@ -1,12 +1,12 @@
### DBUS接口
## DBUS接口
#### 描述
### 描述
实现系统升级以python apt库和aptdeamon的形式
#### Dbus接口信息
### Dbus接口信息
| 名称 | 含义 |
| -------------- | --------------------------------- |
@ -17,7 +17,9 @@
#### Method列表
### Method
#### 方法列表
| Method Name | Input Args | Output Args | means |
| ------------------ | ---------- | ----------- | --------------------------------- |
@ -29,7 +31,15 @@
#### Method分析
#####
#### Signal列表