增加单包分组信息记录

This commit is contained in:
luoxueyi 2022-08-02 16:14:34 +08:00
parent efae843b49
commit 27ceeb4b2a
1 changed files with 29 additions and 0 deletions

View File

@ -269,8 +269,37 @@ class UpdateList():
upgrade_json.update({pkg:pkgs_json})
group_json = {}
for ug in self.upgrade_meta.groups_pkgs:
pkgs_json = {}
with open(self.parent.config_path + str(ug) + ".yaml", "r") as stream:
try:
data_yaml = yaml.safe_load(stream)
pkgs_json.update({"cur_version":""})
pkgs_json.update({"new_version":data_yaml["version"]})
pkgs_json.update({"changelog":data_yaml["changelog"]})
except yaml.YAMLError as exc:
logging.error(exc)
group_json.update({ug:pkgs_json})
single_json = {}
for us in self.upgrade_meta.single_pkgs:
pkg_cache = cache[us]
pkgs_json = {}
pkgs_json.update({"cur_version":getattr(pkg_cache.installed, "version", '')})
if pkg in split_adjust_pkgs:
version_adjust = _adjust_pkgs[split_adjust_pkgs.index(pkg)].split("=")[1]
pkgs_json.update({"new_version":version_adjust})
else:
pkgs_json.update({"new_version":getattr(pkg_cache.candidate, "version", '')})
pkgs_json.update({"changelog":""})
single_json.update({us:pkgs_json})
output_json.update({"upgrade_list":upgrade_json})
output_json.update({"install_list":install_info})
output_json.update({"group_json":group_json})
output_json.update({"single_json":single_json})
#产生JSON文件
with open(output_config_name, 'w', encoding='utf-8') as f: