判断更新与安装

This commit is contained in:
luxoueyi 2021-10-28 14:09:17 +08:00
parent ed1d06021e
commit 10c771798b
1 changed files with 19 additions and 12 deletions

View File

@ -136,19 +136,26 @@ class UpdateListFilterCache(apt.Cache):
for pkg in pkg_lists:
try:
new_ver = ver_in_allowed_origin(pkg, self.allowed_origins)
if new_ver < pkg.candidate:
logging.debug("adjusting candidate version: %s" % new_ver)
pkg.candidate = new_ver
adjust_candidate_pkgs.append(pkg.name)
if not pkg.is_upgradable:
continue
if not pkg.installed: # 判断安装列表
if pkg.candidate == new_ver and pkg not in new_upgrade_pkgs:
new_upgrade_pkgs.append(pkg)
elif new_ver < pkg.cadidate and pkg not in new_upgrade_pkgs:
logging.info("adjusting candidate version: %s" % new_ver)
pkg.candidate = new_ver
adjust_candidate_pkgs.append(pkg.name)
new_upgrade_pkgs.append(pkg)
else: # 判断升级列表
if new_ver < pkg.candidate:
logging.info("adjusting candidate version: %s" % new_ver)
pkg.candidate = new_ver
adjust_candidate_pkgs.append(pkg.name)
if pkg.is_upgradable:
new_upgrade_pkgs.append(pkg)
else:
continue
else:
new_upgrade_pkgs.append(pkg)
pass
else:
if pkg.installed < pkg.candidate:
new_upgrade_pkgs.append(pkg)
continue
if pkg.installed < pkg.candidate:
new_upgrade_pkgs.append(pkg)
except NoAllowedOriginError:
logging.error("Cannot found allowed version: %s", pkg.name)
continue