Skip to content

Commit ba0d69d

Browse files
committed
Set excludes for environments and groups
1 parent 39479ea commit ba0d69d

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

pyanaconda/modules/payloads/payload/dnf/dnf_manager.py

+28-6
Original file line numberDiff line numberDiff line change
@@ -597,17 +597,39 @@ def apply_specs(self, include_list, exclude_list):
597597
:param include_list: a list of specs for inclusion
598598
:param exclude_list: a list of specs for exclusion
599599
"""
600+
environment_excludes = []
601+
group_excludes = []
602+
package_excludes = []
603+
for spec in exclude_list:
604+
if spec.startswith("@^"):
605+
environment_excludes.append(spec[2:])
606+
elif spec.startswith("@"):
607+
group_excludes.append(spec[1:])
608+
else:
609+
package_excludes.append(spec)
610+
611+
log.info("Excluding package specs: %s", package_excludes)
612+
excludes = libdnf5.rpm.PackageQuery(self._base)
613+
excludes.filter_name(package_excludes, libdnf5.common.QueryCmp_GLOB)
614+
self._base.get_rpm_package_sack().add_user_excludes(excludes)
615+
616+
comps_sack = self._base.get_comps_sack()
617+
618+
log.info("Excluding environment specs: %s", environment_excludes)
619+
excludes = libdnf5.comps.EnvironmentQuery(self._base)
620+
excludes.filter_environmentid(environment_excludes, libdnf5.common.QueryCmp_GLOB)
621+
comps_sack.add_user_environment_excludes(excludes)
622+
623+
log.info("Excluding group specs: %s", group_excludes)
624+
excludes = libdnf5.comps.GroupQuery(self._base)
625+
excludes.filter_groupid(group_excludes, libdnf5.common.QueryCmp_GLOB)
626+
comps_sack.add_user_group_excludes(excludes)
627+
600628
log.info("Including specs: %s", include_list)
601629
for spec in include_list:
602630
self._goal.add_install(spec)
603631
self._goal_skip_unavailable.add_install(spec)
604632

605-
log.info("Excluding specs: %s", exclude_list)
606-
# FIXME: Make the excludes work also for groups. Right now, only packages are excluded.
607-
excludes = libdnf5.rpm.PackageQuery(self._base)
608-
excludes.filter_name(exclude_list, libdnf5.common.QueryCmp_GLOB)
609-
self._base.get_rpm_package_sack().add_user_excludes(excludes)
610-
611633
def resolve_selection(self):
612634
"""Resolve the software selection."""
613635
report = ValidationReport()

0 commit comments

Comments
 (0)