Open j-mracek opened 4 months ago
Does it work if you add SOLVER_FLAG_STRONG_RECOMMENDS
/ strongrecommends
? I believe that upgrades weak dependencies to count as "strong" dependencies (e.g. Requires
) and may influence this as you wish.
So you want 'dnf autoremove` remove all weakdeps packages if install_weak_deps us set to false? I.e. the install_weak_deps state at the time where the package was installed should not matter? Or do you want to store the install_weak_deps in the dnf package db like the "autoinstalled" state?
The idea is that dnf autoremove
should be able to find all non-userinstalled packages to remove, including those weak installed.
I believe that user wants to cut from the system all optional packages that were not installed by user. In past, those dependencies (Recommends) could be installed because install_weak_deps=True
or in past there were installed as hard dependency but now they are only recommended.
We've got a request (https://issues.redhat.com/browse/RHEL-27937) to extend functionality of
autoremove
command to also remove optionally weak dependencies as unneeded packages.The current implementation uses empty job and then we use
void solver_get_unneeded(Solver *solv, Queue *unneededq, int filtered);
to get unneeded packages. The result is identical ifsolverflags
containsignorerecommended
or not (see https://github.com/rpm-software-management/libdnf/blob/ef8ac7fcedea1ec87dd3149ce1abdf8daeee25b9/libdnf/sack/query.cpp#L2248).I would like to ask you whether the functionality is supported by libsolv and how we can use it?
I will be happy to provide additional information but I discover that classical testcase does not show unneeded packages. Anyway here is a test case:
Expectation: Detect somehow
pkg-B
as unneeded packages when solver is supposed to ignore weak dependencies. I am completely fine if we will use another method, solver flag to get such information.