ALBS-66: Prepare Jenkins jobs for building distribution of AlmaLinux 8.5

- Script `create_packages_json` can duplicate the packages with
  same version in different variants

Change-Id: I3c79ad06c4c22442423c12d5fa06baf82d663a3f
This commit is contained in:
soksanichenko 2021-11-10 15:29:59 +02:00
parent b2c49dcaf6
commit f2ed64d952

View File

@ -271,7 +271,7 @@ class PackagesGenerator:
) )
) )
) )
all_packages = defaultdict(dict) all_packages = defaultdict(lambda: {'variants': list()})
for repo_info in self.repos: for repo_info in self.repos:
packages = {} # type: Dict[AnyStr, cr.Package] packages = {} # type: Dict[AnyStr, cr.Package]
repomd_records = self._get_repomd_records( repomd_records = self._get_repomd_records(
@ -292,7 +292,9 @@ class PackagesGenerator:
# it presents in the list of included packages # it presents in the list of included packages
continue continue
if package_key not in all_packages: if package_key not in all_packages:
all_packages[package_key]['variant'] = repo_info.name all_packages[package_key]['variants'].append(
repo_info.name
)
all_packages[package_key]['arch'] = repo_info.arch all_packages[package_key]['arch'] = repo_info.arch
all_packages[package_key]['package'] = package all_packages[package_key]['package'] = package
all_packages[package_key]['type'] = repo_info.is_reference all_packages[package_key]['type'] = repo_info.is_reference
@ -305,12 +307,19 @@ class PackagesGenerator:
package, package,
all_packages[package_key]['package'] all_packages[package_key]['package']
) > 0: ) > 0:
all_packages[package_key]['variant'] = repo_info.name all_packages[package_key]['variants'] = [repo_info.name]
all_packages[package_key]['arch'] = repo_info.arch all_packages[package_key]['arch'] = repo_info.arch
all_packages[package_key]['package'] = package all_packages[package_key]['package'] = package
elif self.compare_pkgs_version(
package,
all_packages[package_key]['package']
) == 0:
all_packages[package_key]['variants'].append(
repo_info.name
)
for package_dict in all_packages.values(): for package_dict in all_packages.values():
repo_name = package_dict['variant'] for variant in package_dict['variants']:
repo_arch = package_dict['arch'] repo_arch = package_dict['arch']
package = package_dict['package'] package = package_dict['package']
package_name = package.name package_name = package.name
@ -331,7 +340,7 @@ class PackagesGenerator:
) )
else: else:
src_package_name = src_package_name[0].name src_package_name = src_package_name[0].name
pkgs_list = packages_json[repo_name][ pkgs_list = packages_json[variant][
repo_arch][src_package_name] repo_arch][src_package_name]
added_pkg = f'{package_name}.{package_arch}' added_pkg = f'{package_name}.{package_arch}'
if added_pkg not in pkgs_list: if added_pkg not in pkgs_list: