Skip to content

Commit

Permalink
Set package excludes
Browse files Browse the repository at this point in the history
The `_goal.add_remove` was not a correct way to exclude packages, since
dnf then just complained that the spec was not found and, therefore,
couldn't be removed.
  • Loading branch information
pkratoch committed Jan 27, 2025
1 parent 7b3fed8 commit 0d7ae6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 4 additions & 2 deletions pyanaconda/modules/payloads/payload/dnf/dnf_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,10 @@ def apply_specs(self, include_list, exclude_list):
self._goal.add_install(spec)

log.info("Excluding specs: %s", exclude_list)
for spec in exclude_list:
self._goal.add_remove(spec)
# FIXME: Make the excludes work also for groups. Right now, only packages are excluded.
excludes = libdnf5.rpm.PackageQuery(self._base)
excludes.filter_name(exclude_list, libdnf5.common.QueryCmp_GLOB)
self._base.get_rpm_package_sack().add_user_excludes(excludes)

def resolve_selection(self):
"""Resolve the software selection."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,7 @@ def test_resolve_missing_selection(self):
report = self.dnf_manager.resolve_selection()
assert report.error_messages == [
'No match for argument: p1',
'No packages to remove for argument: p2',
'No match for argument: g1',
'No groups to remove for argument: g2',
]
assert report.warning_messages == []

Expand All @@ -347,9 +345,7 @@ def test_ignore_missing_packages(self):
assert report.error_messages == []
assert report.warning_messages == [
'No match for argument: p1',
'No packages to remove for argument: p2',
'No match for argument: g1',
'No groups to remove for argument: g2',
]

@pytest.mark.skip("Not implemented")
Expand Down

0 comments on commit 0d7ae6e

Please sign in to comment.