- Excluded/included modules/packages will be processed correctly

This commit is contained in:
soksanichenko 2023-04-02 22:27:24 +03:00
parent a25bf72fb8
commit 68915d04f8
1 changed files with 28 additions and 15 deletions

View File

@ -331,12 +331,20 @@ class PackagesGenerator:
result = package.arch result = package.arch
return result return result
def is_skipped_module_package(self, package: Package) -> bool: def is_skipped_module_package(
self,
package: Package,
variant_arch: str,
) -> bool:
package_key = self.get_package_key(package, variant_arch)
# Even a module package will be added to packages.json if # Even a module package will be added to packages.json if
# it presents in the list of included packages # it presents in the list of included packages
return 'module' in package.release and not any( return 'module' in package.release and not any(
re.search(included_package, package.name) re.search(
for included_package in self.included_packages f'^{included_pkg}$',
package_key,
) or included_pkg in (package.name, package_key)
for included_pkg in self.included_packages
) )
def is_excluded_package( def is_excluded_package(
@ -345,11 +353,13 @@ class PackagesGenerator:
variant_arch: str, variant_arch: str,
excluded_packages: List[str], excluded_packages: List[str],
) -> bool: ) -> bool:
package_key = self.get_package_key(package, variant_arch)
return any( return any(
re.search( re.search(
excluded_pkg, f'^{excluded_pkg}$',
self.get_package_key(package, variant_arch), package_key,
) for excluded_pkg in excluded_packages ) or excluded_pkg in (package.name, package_key)
for excluded_pkg in excluded_packages
) )
@staticmethod @staticmethod
@ -376,18 +386,21 @@ class PackagesGenerator:
for repo_info in variant_info.repos: for repo_info in variant_info.repos:
is_reference = repo_info.is_reference is_reference = repo_info.is_reference
for package in self.get_packages_iterator(repo_info=repo_info): for package in self.get_packages_iterator(repo_info=repo_info):
if self.is_skipped_module_package(package): if self.is_skipped_module_package(
continue package=package,
if self.is_excluded_package( variant_arch=variant_info.arch,
package,
variant_info.arch,
self.excluded_packages,
): ):
continue continue
if self.is_excluded_package( if self.is_excluded_package(
package, package=package,
variant_info.arch, variant_arch=variant_info.arch,
variant_info.excluded_packages, excluded_packages=self.excluded_packages,
):
continue
if self.is_excluded_package(
package=package,
variant_arch=variant_info.arch,
excluded_packages=variant_info.excluded_packages,
): ):
continue continue
package_key = self.get_package_key( package_key = self.get_package_key(