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

Autoremove option? #45

Open
galderz opened this issue Jun 24, 2019 · 7 comments
Open

Autoremove option? #45

galderz opened this issue Jun 24, 2019 · 7 comments
Labels

Comments

@galderz
Copy link

galderz commented Jun 24, 2019

There doesn't appear to be a microdnf autoremove option to remove a package and its dependencies. Any plans to add that?

Any workarounds other than listing dependent packages manually?

@m-blaha m-blaha added the dnf5 label Jan 27, 2021
@pabelanger
Copy link

clean_requirements_on_remove=True also seems ignored

@jhutar
Copy link

jhutar commented Aug 28, 2022

Terribly ugly solution, but this is what I'm going to do in one my container - might be handy:

RUN rpm -qa | sort >/before.txt \
    && microdnf install -y gcc gcc-c++ kernel-devel python3-devel glew-devel msgpack-devel freeglut-devel libpng-devel freetype-devel libxml2-devel glm-devel mmtf-cpp-devel netcdf-cxx-devel \
    && rpm -qa | sort >/after.txt \
    && echo "Do what I needed to do with the packages installed" \
    && microdnf remove -y $( comm -13 /before.txt /after.txt ) \
    && rm /before.txt /after.txt \
    && microdnf clean all

@j-mracek
Copy link
Contributor

I think we will add that functionality to DNF5 project. DNF5 is going to replace microdnf (Fedora 38) and then DNF

@ghost
Copy link

ghost commented Nov 11, 2022

I may be mistaken, but could it be comm -23 /before.txt /after.txt? (i.e. -2 remove unique from after.txt because they are NEW, -3 remove lines in both).
Also, I observed that when performing microdnf update it removes old packages as default, is this right? With this behavior, I update packages first, and then install any packages. After that rpm does not report old packages. Anyway, package update may not be desirable for some environments and comm .. solution would be a valid workaround for us.

@j-mracek
Copy link
Contributor

I may be mistaken, but could it be comm -23 /before.txt /after.txt? (i.e. -2 remove unique from after.txt because they are NEW, -3 remove lines in both). Also, I observed that when performing microdnf update it removes old packages as default, is this right? With this behavior, I update packages first, and then install any packages. After that rpm does not report old packages. Anyway, package update may not be desirable for some environments and comm .. solution would be a valid workaround for us.

DNF and microdnf during package upgrade always remove the old version of package with one exception - installonly packages. They are identify by provides in configuration option installonlypkgs. Therefore if you want to upgrade package foo and keep old version of foo then just use --setopt=installonlypkgs=foo and it should work. BUT - packages must be ready for such a situation - no file conflict. Also number of installonly packages is limited by installonly_limit configuration option. Please check dnf man pages for further information.

@jhutar
Copy link

jhutar commented Jan 2, 2023

Hello @gbarceloPIB . comm -13 ... worked for me, but I might be missing some use-case:

$ echo -e "one\nthree" | sort >before
$ echo -e "one\ntwo\nthree" | sort >after
$ comm -13 before after 
two

@keithbowes
Copy link

DNF5 is going to replace microdnf (Fedora 38) and then DNF

It's unfortunate that DNF5 replaces this. I cloned this repo and compiled it; it compiled in under a minute. DNF5, on the other hand, takes hours (and I didn't have to edit microdnf's source code to get it to compile like I did with DNF5). I know the long compile time is just because DNF5 is written in C++ instead of plain C. It's a mystery to me why people use C++; do they just like spending more time compiling than developing? I guess anyone who has a desire to compile DNF5 should just feel lucky that it's not written in Rust, though (it might take days instead of hours if it were).

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

No branches or pull requests

6 participants