Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend unneeded packages by weak dependencies #553

Open
j-mracek opened this issue Mar 6, 2024 · 4 comments
Open

Extend unneeded packages by weak dependencies #553

j-mracek opened this issue Mar 6, 2024 · 4 comments

Comments

@j-mracek
Copy link
Contributor

j-mracek commented Mar 6, 2024

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 if solverflags contains ignorerecommended 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:

repo @System 0 testtags <inline>
#>=Pkg: pkg-A 1.0 1 noarch
#>=Prv: pkg-A = 1.0-1
#>=Rec: pkg-B
#>=Pkg: pkg-B 1.0 1 noarch
#>=Prv: pkg-B = 1.0-1

system x86_64 rpm @System
poolflags implicitobsoleteusescolors whatprovideswithdisabled
solverflags allowdowngrade allowvendorchange ignorerecommended keepexplicitobsoletes bestobeypolicy keeporphans yumobsoletes
job userinstalled pkg pkg-A-1.0-1.noarch@@System
result transaction,problems <inline>

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.

@Conan-Kudo
Copy link
Member

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.

@mlschroe
Copy link
Member

mlschroe commented Mar 7, 2024

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?

@Conan-Kudo
Copy link
Member

The idea is that dnf autoremove should be able to find all non-userinstalled packages to remove, including those weak installed.

@j-mracek
Copy link
Contributor Author

j-mracek commented Mar 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants