优化:取消调整cache,加快速度且避免损坏cache
This commit is contained in:
parent
8693fa8699
commit
12a1fec1d6
|
@ -97,7 +97,6 @@ class UpdateListFilterCache(apt.Cache):
|
|||
for i in files:
|
||||
if ".json" in i:
|
||||
jsonfiles.append(i.split('.')[0])
|
||||
# logging.info("all files: %s", jsonfiles)
|
||||
|
||||
# 找到importantlist中对应的json文件
|
||||
for i in importantList:
|
||||
|
@ -116,12 +115,10 @@ class UpdateListFilterCache(apt.Cache):
|
|||
pkgdict = f.read()
|
||||
jsonfile = json.loads(pkgdict)
|
||||
tmplist = jsonfile['install_list']
|
||||
# print("\ntmplist: ", tmplist)
|
||||
for j in tmplist:
|
||||
if j not in self.upgradeList:
|
||||
self.upgradeList.append(j)
|
||||
f.close()
|
||||
# logging.info("self.upgradeList: %s", self.upgradeList)
|
||||
|
||||
# 更改:传入包列表,经过源过滤,返回的pkg中进行版本调整
|
||||
def check_in_allowed_origin(self, pkg_lists):
|
||||
|
@ -135,13 +132,13 @@ class UpdateListFilterCache(apt.Cache):
|
|||
new_upgrade_pkgs.append(pkg)
|
||||
elif new_ver < pkg.candidate and pkg not in new_upgrade_pkgs:
|
||||
logging.info("adjusting candidate version: %s" % new_ver)
|
||||
pkg.candidate = new_ver
|
||||
# pkg.candidate = new_ver
|
||||
adjust_candidate_pkgs.append(pkg.name+"="+pkg.candidate.version)
|
||||
new_upgrade_pkgs.append(pkg)
|
||||
else: # 判断升级列表
|
||||
if new_ver < pkg.candidate:
|
||||
logging.info("adjusting candidate version: %s" % new_ver)
|
||||
pkg.candidate = new_ver
|
||||
# pkg.candidate = new_ver
|
||||
adjust_candidate_pkgs.append(pkg.name+"="+pkg.candidate.version)
|
||||
if pkg.is_upgradable:
|
||||
new_upgrade_pkgs.append(pkg)
|
||||
|
@ -173,51 +170,8 @@ class UpdateListFilterCache(apt.Cache):
|
|||
whitelist_filter_upgrade_pkgs.append(pkg)
|
||||
else :
|
||||
pkg.mark_keep()
|
||||
pass
|
||||
# print("skipping whitelist package %s" % pkg.name)
|
||||
|
||||
return whitelist_filter_upgrade_pkgs
|
||||
|
||||
# def try_to_upgrade(pkg, # type: apt.Package
|
||||
# pkgs_to_upgrade, # type: List[apt.Package]
|
||||
# pkgs_kept_back, # type: KeptPkgs
|
||||
# allowed_origins, # type: List[str]
|
||||
# ):
|
||||
# # type: (...) -> None
|
||||
# try:
|
||||
# try:
|
||||
# # try to adjust pkg itself first, if that throws an exception it
|
||||
# # can't be upgraded on its own
|
||||
# cache.adjust_candidate(pkg)
|
||||
# if not pkg.is_upgradable:
|
||||
# return
|
||||
# except NoAllowedOriginError:
|
||||
# return
|
||||
# cache._cached_candidate_pkgnames.add(pkg.name)
|
||||
# cache.mark_upgrade_adjusted(pkg, from_user=not pkg.is_auto_installed)
|
||||
# if check_changes_for_sanity(cache, allowed_origins,
|
||||
# blacklisted_pkgs, whitelisted_pkgs,
|
||||
# pkg):
|
||||
# # add to packages to upgrade
|
||||
# pkgs_to_upgrade.append(pkg)
|
||||
# # re-eval pkgs_kept_back as the resolver may fail to
|
||||
# # directly upgrade a pkg, but that may work during
|
||||
# # a subsequent operation, see debian bug #639840
|
||||
# pkgs_to_upgrade.extend(pkgs_kept_back.pop_upgradable(cache))
|
||||
# else:
|
||||
# logging.debug("sanity check failed for: %s"
|
||||
# % str({str(p.candidate)
|
||||
# for p in cache.get_changes()}))
|
||||
# rewind_cache(cache, pkgs_to_upgrade)
|
||||
# pkgs_kept_back.add(pkg, cache)
|
||||
# except (SystemError, NoAllowedOriginError) as e:
|
||||
# # can't upgrade
|
||||
# logging.warning(
|
||||
# _("package %s upgradable but fails to "
|
||||
# "be marked for upgrade (%s)"), pkg.name, e)
|
||||
# rewind_cache(cache, pkgs_to_upgrade)
|
||||
# pkgs_kept_back.add(pkg, cache)
|
||||
|
||||
def ver_in_allowed_origin(pkg, allow_origin):
|
||||
# type: (apt.Package, List[str]) -> apt.package.Version
|
||||
for ver in pkg.versions:
|
||||
|
@ -234,7 +188,6 @@ def ver_in_allowed_origin(pkg, allow_origin):
|
|||
return ver
|
||||
raise NoAllowedOriginError()
|
||||
|
||||
|
||||
def get_allowed_origins():
|
||||
# type: () -> List[str]
|
||||
""" return a list of allowed origins from apt.conf
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
#!/usr/bin/dh-exec
|
||||
backend/data/kylin-system-updater.db /usr/share/kylin-system-updater/
|
||||
backend/data/30kylin-system-updater /etc/apt/apt.conf.d/
|
||||
backend/data/kylin-system-updater.service /usr/lib/systemd/system/
|
||||
backend/data/com.kylin.systemupgrade.conf /etc/dbus-1/system.d/
|
||||
backend/build/scripts-3.8/kylin-system-updater /usr/bin/
|
||||
backend/build/lib/SystemUpdater/Core/*
|
||||
backend/build/mo/* /usr/share/locale
|
||||
backend/build/lib/SystemUpdater/UpdateManager.py /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/build/lib/SystemUpdater/UpdateManagerDbus.py /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/build/lib/SystemUpdater/UpdateManager.py /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/build/lib/SystemUpdater/backend /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/build/lib/SystemUpdater/UpdateManagerVersion.py /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/build/lib/SystemUpdater/__init__.py /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/build/lib/SystemUpdater/Core /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/kylin-system-updater /usr/bin/
|
||||
backend/SystemUpdater/* /usr/lib/python3.8/dist-packages/SystemUpdater/
|
||||
backend/build/mo/* /usr/share/locale/
|
||||
plugin/translations/* /usr/share/Upgrade/translations/
|
||||
plugin/libupgrade.so /usr/lib/
|
||||
|
|
Loading…
Reference in New Issue