@@ -597,17 +597,39 @@ def apply_specs(self, include_list, exclude_list):
597
597
:param include_list: a list of specs for inclusion
598
598
:param exclude_list: a list of specs for exclusion
599
599
"""
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
+
600
628
log .info ("Including specs: %s" , include_list )
601
629
for spec in include_list :
602
630
self ._goal .add_install (spec )
603
631
self ._goal_skip_unavailable .add_install (spec )
604
632
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
-
611
633
def resolve_selection (self ):
612
634
"""Resolve the software selection."""
613
635
report = ValidationReport ()
0 commit comments