-
Task
-
Resolution: Done
-
Undefined
-
None
-
None
-
None
-
image-builder-1
-
3
After https://github.com/osbuild/osbuild/pull/2379, I realized that I could use the same sack-level filtering to implement the last missing critical feature in DNF5 solver, which is the handling of `exclude_specs`, so here it is...
The DNF5 solver was silently ignoring `exclude_specs` on depsolve transactions, while the DNF4 solver handled them natively via `install_specs()`. This meant features like excluding firmware packages from a `@core` group install, or excluding a package in one transaction while installing it in another, were broken on DNF5. This PR adds the missing functionality using the same `sack.add_user_excludes()` pattern already proven for `repo_ids` filtering, bringing DNF5 to parity with DNF4 for package excludes.
-
- Architectural Changes
DNF4's `install_specs()` accepts both package specs and exclude specs in a single call, handling exclusion internally via `sack.add_excludes()`. DNF5's `Goal.add_install()` API has no equivalent – it only takes package specs. After reviewing the libdnf5 API (Goal, GoalJobSettings, PackageSack), `sack.add_user_excludes()` is the only runtime mechanism for per-transaction package exclusion. The exclude block is placed after `add_rpm_install()` (which re-adds packages from previous transactions) to match DNF4's ordering where `package_install()` precedes `install_specs()`. Excludes are automatically scoped per-transaction because `sack.clear_user_excludes()` is already called at the start of each loop iteration.
-
- Key Changes
- Add `exclude_specs` handling in the DNF5 depsolve loop using `sack.add_user_excludes()` with GLOB-based name filtering, supporting both exact names and glob patterns
- Add unit tests for exclude behavior: one verifying excludes affect dependency resolution (not just top-level requests), another verifying excludes don't leak across transactions
- Remove `basic_pkg_group_with_excludes` and `install_pkg_excluded_in_another_transaction` from the DNF5 broken test cases skip list
-
- Breaking Changes
This PR is fully backward compatible.
/jira-epic HMS-10032