修改逻辑

This commit is contained in:
Xueyi Luo 2021-11-16 16:23:02 +08:00
parent 9e68f82128
commit c27cdd71c9
1 changed files with 23 additions and 12 deletions

View File

@ -159,6 +159,7 @@ class Sqlite3Server(object):
# 判断更新方式
if mode == MODE_UPGRADE_PARTIAL: # 部分更新
pkg_adj = ""
# 判断更新包为单包或更新组
if pkg_group:
# 更新组
@ -170,20 +171,30 @@ class Sqlite3Server(object):
for adj in adjust_pkg:
if pkgname in adj:
# 该部分升级的单包为调整版本,与候选版本不一致
pkgname = adj
pkg_adj = adj
break
try:
pkg = self.window_main.cache[pkgname.split("=")[0]]
for ver in pkg.versions:
if ver.version == pkgname.split("=")[1]:
pkg_inst_ver = ver
break
pkgname = pkgname.split("=")[0]
except Exception as e:
logging.error(_("%s could not be detected in the source because the source was changed or for other reasons."), \
if pkg_adj: # 有调整的情况
try:
pkg = self.window_main.cache[pkg_adj.split("=")[0]]
for ver in pkg.versions:
if ver.version == pkg_adj.split("=")[1]:
pkg_inst_ver = ver
break
pkgname = pkg_adj.split("=")[0]
pkgversion = str(pkg_inst_ver.source_version)
pkgdescription = str(pkg_inst_ver.description)
except Exception as e:
logging.error(_("%s could not be detected in the source because the source was changed or for other reasons."), \
str(pkgname))
pkgversion = str(pkg_inst_ver.source_version)
pkgdescription = str(pkg_inst_ver.description)
logging.error(str(e))
else: # 没有调整的情况
try:
pkg = self.window_main.cache[pkgname]
pkgversion = str(pkg.candidate.version)
pkgdescription = str(pkg.candidate.raw_description)
except Exception as e:
logging.error(str(e))
try:
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr)
# FIXME: 发送插入数据库成功的信号local_upgrade_list