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

This commit is contained in:
wangsong 2021-12-02 17:07:51 +08:00
commit 62012db6b3
1 changed files with 23 additions and 19 deletions

View File

@ -150,12 +150,12 @@ class UpdateManager():
return False,"<"+debname+"> Not a DEB package."
logging.info("About to Install Package: %s.",str(debname))
try:
dep_satisfy = self._attempt_depends(deb_path,_check_local_dep,_auto_satisfy)
dep_satisfy, err_args = 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()
else:
self.dbusController.InstalldebFinished(dep_satisfy, err_args['error_string'], err_args['error_desc'])
except Exception as e:
logging.info(str(e))
@ -418,13 +418,12 @@ class UpdateManager():
depends_pkg = []
satisfy_list = []
depends_count = 0
_error_str = ""
_local_satisfy = False
deb_cache = self.cache
err_args = {'error_string':'','error_desc':''}
absolute_path, debname = os.path.split(deb_path)
if deb_cache == None:
deb_cache = Cache()
try:
deb_cache = Cache()
deb = DebPackage(deb_path, deb_cache)
deb.check()
(install, remove, unauth) = deb.required_changes
@ -435,8 +434,8 @@ class UpdateManager():
if _check_local_dep: #查找本地
if remove:
logging.error("Need uninstall: %s.",str(remove))
_error_str = "Installing "+str(debname.split("_")[0])+" requires uninstalling: "+str(remove)
logging.error(_error_str)
err_args['error_string'] = "Installing "+str(debname.split("_")[0])+" requires uninstalling: "+str(remove)
logging.error(err_args['error_string'])
# 需要查找本地依赖
elif len(install) > 0:
for pkg in deb_cache:
@ -458,8 +457,9 @@ class UpdateManager():
_local_satisfy = True
elif not _auto_satisfy:
_local_satisfy = False
_error_str = str(debname.split("_")[0])+"dependency is not satisfied, will download: "+",".join(install)
logging.error(_error_str)
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'])
else:
#将应用包与依赖包拷贝至archive目录安装
try:
@ -467,24 +467,28 @@ class UpdateManager():
satisfy_list.append(debname)
for satisfy in satisfy_list:
shutil.copy(os.path.join(absolute_path,satisfy),"/var/cache/apt/archives/")
logging.info("move debpkg: %s",satisfy)
_local_satisfy = True
except Exception as e:
logging.info(str(e))
return _local_satisfy
return _local_satisfy,err_args
elif not _check_local_dep and _auto_satisfy:
_local_satisfy = True
if install:
_error_str = str(debname.split("_")[0])+"dependency is not satisfied, will download: "+",".join(install)
logging.error(_error_str)
return _local_satisfy
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
elif not _check_local_dep and not _auto_satisfy:
_local_satisfy = False
if install:
_error_str = str(debname.split("_")[0])+" dependency is not satisfied: "+",".join(install)
logging.error(_error_str)
return _local_satisfy
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
# 依赖满足
else:
_local_satisfy = True
return _local_satisfy
err_args = {'error_string':'','error_desc':''}
return _local_satisfy,err_args