rpm-software-management / libdnf

Package management library.
GNU Lesser General Public License v2.1
184 stars 139 forks source link

Since we use rpmtsAddReinstallElement rpm also uninstalls the package #1660

Closed kontura closed 5 months ago

kontura commented 6 months ago

It calls callbacks for RPMCALLBACK_INST_START and RPMCALLBACK_INST_PROGRESS just like before when the reinstall was done through regural install (rpmtsAddInstallElement) but in addition it also calls RPMCALLBACK_UNINST_START and RPMCALLBACK_UNINST_PROGRESS. To ensure they find the DnfPackage add it to remove_helper array.

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall). We could try to hide one of the them but I think a better solution is to report what is actually happening and report one install and one uninstall.

Fixes: https://github.com/rpm-software-management/libdnf/issues/1653

This is for the context part of libdnf (microdnf, packagekit, ...)

jan-kolarik commented 5 months ago

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall).

Does this mean that the package is mentioned twice in the transaction table?

kontura commented 5 months ago

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall).

Does this mean that the package is mentioned twice in the transaction table?

It looks like this:

Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                                                            Repository                                                 Size
Reinstalling:
 bash-5.2.26-3.fc40.x86_64                                                                                                                         fedora                                                   1.9 MB
   replacing bash-5.2.26-3.fc40.x86_64
Transaction Summary:
 Installing:        0 packages
 Reinstalling:      1 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Is this ok [y/N]: y
Downloading packages...
Running transaction test...
Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora
Complete.

Before instead of:

Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora

there was just:

Reinstalling: bash;5.2.26-3.fc40;x86_64;fedora
jan-kolarik commented 5 months ago

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall).

Does this mean that the package is mentioned twice in the transaction table?

It looks like this:

Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                                                            Repository                                                 Size
Reinstalling:
 bash-5.2.26-3.fc40.x86_64                                                                                                                         fedora                                                   1.9 MB
   replacing bash-5.2.26-3.fc40.x86_64
Transaction Summary:
 Installing:        0 packages
 Reinstalling:      1 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Is this ok [y/N]: y
Downloading packages...
Running transaction test...
Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora
Complete.

Before instead of:

Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora

there was just:

Reinstalling: bash;5.2.26-3.fc40;x86_64;fedora

That looks fine, thanks for the example!