更改信号

This commit is contained in:
luoxueyi 2021-12-02 17:10:08 +08:00
parent b59ab1de9b
commit 0003904006
2 changed files with 30 additions and 23 deletions

View File

@ -140,22 +140,28 @@ class UpdateManager():
def start_deb_install(self, deb_path = "", _check_local_dep = False, _auto_satisfy = False):
# _check_local_dep : 是否查询本地依赖
# _auto_satisfy : 是否通过网络下载依赖
header = ''
desc = ''
# 包常规检查
absolute_path, debname = os.path.split(deb_path)
if not os.path.exists(deb_path):
logging.error("<%s> does not exist.",debname)
return False,"<"+debname+"> does not exist."
logging.error("Path <%s> does not exist.",deb_path)
header = "Path <"+deb_path+"> does not exist."
self.dbusController.InstalldebFinished(False, header, desc)
return False,"Path "+"<"+deb_path+"> does not exist."
elif not debname.endswith(".deb"):
logging.error("<%s> Not a DEB package.",debname)
header = "<"+debname+"> Not a DEB package."
self.dbusController.InstalldebFinished(False, header, desc)
return False,"<"+debname+"> Not a DEB package."
logging.info("About to Install Package: %s.",str(debname))
try:
dep_satisfy, err_args = self._attempt_depends(deb_path,_check_local_dep,_auto_satisfy)
dep_satisfy, header, desc = self._attempt_depends(deb_path,_check_local_dep,_auto_satisfy)
if dep_satisfy:
install_backend = get_backend(self, InstallBackend.ACTION_INSTALL_DEB)
install_backend.start_alone(partial_upgrade_list = deb_path, _is_install = _auto_satisfy)
else:
self.dbusController.InstalldebFinished(dep_satisfy, err_args['error_string'], err_args['error_desc'])
self.dbusController.InstalldebFinished(dep_satisfy, header, desc)
except Exception as e:
logging.info(str(e))
@ -419,8 +425,8 @@ class UpdateManager():
satisfy_list = []
depends_count = 0
_local_satisfy = False
err_args = {'error_string':'','error_desc':''}
error_string = ''
error_desc = ''
absolute_path, debname = os.path.split(deb_path)
try:
deb_cache = Cache()
@ -434,8 +440,8 @@ class UpdateManager():
if _check_local_dep: #查找本地
if remove:
logging.error("Need uninstall: %s.",str(remove))
err_args['error_string'] = "Installing "+str(debname.split("_")[0])+" requires uninstalling: "+str(remove)
logging.error(err_args['error_string'])
error_string = "Installing "+str(debname.split("_")[0])+" requires uninstalling: "+str(remove)
logging.error(error_string)
# 需要查找本地依赖
elif len(install) > 0:
for pkg in deb_cache:
@ -457,9 +463,9 @@ class UpdateManager():
_local_satisfy = True
elif not _auto_satisfy:
_local_satisfy = False
err_args['error_string'] = str(debname.split("_")[0])+" dependency is not satisfied. "
err_args['error_desc'] = ",".join(install)
logging.error(err_args['error_string']+ err_args['error_desc'])
error_string = str(debname.split("_")[0])+" dependency is not satisfied. "
error_desc = ",".join(install)
logging.error(error_string+ error_desc)
else:
#将应用包与依赖包拷贝至archive目录安装
try:
@ -471,24 +477,25 @@ class UpdateManager():
_local_satisfy = True
except Exception as e:
logging.info(str(e))
return _local_satisfy,err_args
return _local_satisfy,error_string,error_desc
elif not _check_local_dep and _auto_satisfy:
_local_satisfy = True
if install:
err_args['error_string'] = str(debname.split("_")[0])+" dependency is not satisfied, will download. "
err_args['error_desc'] = ",".join(install)
logging.error(err_args['error_string']+ err_args['error_desc'])
return _local_satisfy,err_args
error_string = str(debname.split("_")[0])+" dependency is not satisfied, will download. "
error_desc = ",".join(install)
logging.error(error_string+error_desc)
return _local_satisfy,error_string,error_desc
elif not _check_local_dep and not _auto_satisfy:
_local_satisfy = False
if install:
err_args['error_string'] = str(debname.split("_")[0])+" dependency is not satisfied. "
err_args['error_desc'] = ",".join(install)
logging.error(err_args['error_string']+ err_args['error_desc'])
return _local_satisfy,err_args
error_string = str(debname.split("_")[0])+" dependency is not satisfied. "
error_desc = ",".join(install)
logging.error(error_string+error_desc)
return _local_satisfy,error_string,error_desc
# 依赖满足
else:
_local_satisfy = True
err_args = {'error_string':'','error_desc':''}
return _local_satisfy,err_args
error_string = ''
error_desc=''
return _local_satisfy,error_string,error_desc

View File

@ -493,6 +493,6 @@ class UpdateManagerDbusController(dbus.service.Object):
#安装进度信息 0~100 进度信息 101为非预期的信号
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='bss')
def InstalldebStatusChanged(self,progress,status,current_details):
logging.info(COLORLOG_PREFIX + "emit" + COLORLOG_SUFFIX +" PurgePkgStatusChanged progress = %d , status = %s ,current_details = %s",\
logging.info(COLORLOG_PREFIX + "emit" + COLORLOG_SUFFIX +" InstalldebStatusChanged progress = %d , status = %s ,current_details = %s",\
progress,status,current_details)