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

This commit is contained in:
wangsong 2022-08-04 14:35:45 +08:00
commit 4e2d5ccfbc
2 changed files with 13 additions and 3 deletions

View File

@ -776,9 +776,9 @@ class UpdateManager():
absolute_path, debname = os.path.split(deb_path)
# 检查本地破损
try:
logging.info("Install package, open cache")
logging.info("Install deb package, open cache")
deb_cache = Cache()
logging.info("Install package, check broken")
logging.info("Install deb package, check broken")
broken_count = deb_cache._depcache.broken_count
deb = DebPackage(deb_path, deb_cache)
deb.check(allow_downgrade=True)

View File

@ -283,12 +283,22 @@ class InstallBackend():
self.install_deb(install_path = partial_upgrade_list, install_force = _is_install)
except Exception as e:
logging.error(str(e))
# 安装在线包的接口
elif self.action == self.ACTION_BACKGROUND_UPGRADE:
try:
pkgs_install = partial_upgrade_list
pkgs_install = [ str(pkg) for pkg in partial_upgrade_list]
logging.info("Install deb package, open cache")
cache = Cache()
for pkg_name in pkgs_install:
if pkg_name not in cache:
if "=" not in pkg_name or ("=" in pkg_name and pkg_name.split("=")[0] not in cache):
# 没找到包或格式不正确
self.window_main.dbusController.UpdateInstallFinished(False, pkgs_install, "'"+pkg_name+"' is not in cache", "")
return
self.commit(self.ACTION_INSTALL,pkgs_install,[],[])
except Exception as e:
logging.error(str(e))
self.window_main.dbusController.UpdateInstallFinished(False, pkgs_install, str(e), "")
def update(self):
"""Run a update to refresh the package list"""